Subversion Repositories HelenOS

Rev

Rev 3034 | Rev 3037 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3034 Rev 3035
Line 511... Line 511...
511
     * disconnected phone. This ensures the kbox thread is going to
511
     * disconnected phone. This ensures the kbox thread is going to
512
     * wake up and terminate.
512
     * wake up and terminate.
513
     */
513
     */
514
    ipc_answerbox_slam_phones(&TASK->kernel_box, have_kb_thread);
514
    ipc_answerbox_slam_phones(&TASK->kernel_box, have_kb_thread);
515
   
515
   
516
    /* TODO: Wait for kbox thread to terminate */
-
 
517
    if (have_kb_thread) {
516
    if (have_kb_thread) {
518
        klog_printf("ipc_kbox_cleanup - wait for kbox thread to finish");
517
        klog_printf("join kb_thread..");
519
        waitq_sleep(&TASK->kb_thread_shutdown_wq);
518
        thread_join(TASK->kb_thread);
-
 
519
        klog_printf("join done");
-
 
520
        TASK->kb_thread = NULL;
520
    }
521
    }
521
 
522
 
522
    /* Answer all messages in 'calls' and 'dispatched_calls' queues */
523
    /* Answer all messages in 'calls' and 'dispatched_calls' queues */
523
    spinlock_lock(&TASK->kernel_box.lock);
524
    spinlock_lock(&TASK->kernel_box.lock);
524
    ipc_cleanup_call_list(&TASK->kernel_box.dispatched_calls);
525
    ipc_cleanup_call_list(&TASK->kernel_box.dispatched_calls);
Line 755... Line 756...
755
                interrupts_restore(ipl);
756
                interrupts_restore(ipl);
756
            }
757
            }
757
        }
758
        }
758
    }
759
    }
759
 
760
 
760
    klog_printf("kbox: done, waking up possible shutdown routine");
-
 
761
    waitq_wakeup(&TASK->kb_thread_shutdown_wq, WAKEUP_ALL);
-
 
762
    klog_printf("kbox: finished");
761
    klog_printf("kbox: finished");
763
}
762
}
764
 
763
 
765
 
764
 
766
/**
765
/**
Line 828... Line 827...
828
        mutex_unlock(&ta->kb_cleanup_lock);
827
        mutex_unlock(&ta->kb_cleanup_lock);
829
        return ENOMEM;
828
        return ENOMEM;
830
    }
829
    }
831
 
830
 
832
    ta->kb_thread = kb_thread;
831
    ta->kb_thread = kb_thread;
833
 
-
 
834
    /* FIXME: we could join the kbox thread */
-
 
835
    thread_detach(kb_thread);
-
 
836
    thread_ready(kb_thread);
832
    thread_ready(kb_thread);
837
 
833
 
838
    mutex_unlock(&ta->kb_cleanup_lock);
834
    mutex_unlock(&ta->kb_cleanup_lock);
839
 
835
 
840
    return newphid;
836
    return newphid;