rem: cpu_status state; struct thread *t; int rc;
context: wait_for_thread(thread_id id, status_t *_returnCode){	sem_id sem;	cpu_status state;	struct thread *t;	int rc;	rc = send_signal_etc(id, SIGCONT, 0);	if (rc != B_OK)		return rc;		state = disable_interrupts();	GRAB_THREAD_LOCK();	t = thread_get_thread_struct_locked(id);	sem = t != NULL ? t->return_code_sem : B_BAD_THREAD_ID;	RELEASE_THREAD_LOCK();	restore_interrupts(state);	rc = acquire_sem(sem);	/* This thread died the way it should, dont ripple a non-error up */	if (rc == B_BAD_SEM_ID) {		rc = B_NO_ERROR;		if (_returnCode) {			t = thread_get_current_thread();			TRACE(("wait_for_thread: thread %ld got return code 0x%x\n",				t->id, t->sem_deleted_retcode));			*_returnCode = t->sem_deleted_retcode;		}	}	return rc;}