614,13 → 614,18 |
{ |
call_t *call; |
int method; |
bool done; |
ipl_t ipl; |
|
(void)arg; |
klog_printf("kbox_thread_proc()"); |
while (1) { |
done = false; |
|
while (!done) { |
klog_printf("kbox: wait for call"); |
call = ipc_wait_for_call(&TASK->kernel_box, SYNCH_NO_TIMEOUT, |
SYNCH_FLAGS_NONE); |
|
if (call != NULL) { |
method = IPC_GET_METHOD(call->data); |
|
627,8 → 632,29 |
if (method == IPC_M_DEBUG_ALL) { |
udebug_call_receive(call); |
} |
|
if (method == IPC_M_PHONE_HUNGUP) { |
klog_printf("kbox: handle hangup message\n"); |
IPC_SET_RETVAL(call->data, 0); |
ipc_answer(&TASK->kernel_box, call); |
|
ipl = interrupts_disable(); |
spinlock_lock(&TASK->lock); |
spinlock_lock(&TASK->answerbox.lock); |
if (list_empty(&TASK->answerbox.connected_phones)) { |
/* Last phone has been disconnected */ |
TASK->kb_thread = NULL; |
done = true; |
printf("phone list is empty\n"); |
} |
spinlock_unlock(&TASK->answerbox.lock); |
spinlock_unlock(&TASK->lock); |
interrupts_restore(ipl); |
} |
} |
} |
|
klog_printf("kbox: finished"); |
} |
|
/** |
665,6 → 691,7 |
if (!ta->kb_thread) |
return ENOMEM; |
|
thread_detach(ta->kb_thread); |
thread_ready(ta->kb_thread); |
} |
|