Fix a deadlock bug in MCS-PDR locks
[akaros.git] / user / parlib / thread0_sched.c
index 3ae38d4..64a7842 100644 (file)
@@ -29,6 +29,7 @@ struct schedule_ops thread0_2ls_ops = {
        .thread_blockon_sysc = thread0_thread_blockon_sysc,
        .thread_refl_fault = thread0_thread_refl_fault,
        .thread_runnable = thread0_thread_runnable,
+       .thread_paused = thread0_thread_runnable,
        .thread_has_blocked = thread0_thread_has_blocked,
 };
 
@@ -53,7 +54,8 @@ static void thread0_handle_syscall(struct event_msg *ev_msg,
 void thread0_lib_init(void)
 {
        memset(&thread0_info, 0, sizeof(thread0_info));
-       sysc_evq = get_big_event_q();
+       /* we don't care about the message, so don't bother with a UCQ */
+       sysc_evq = get_eventq(EV_MBOX_BITMAP);
        sysc_evq->ev_flags = EVENT_INDIR | EVENT_WAKEUP;
        register_ev_handler(EV_SYSCALL, thread0_handle_syscall, 0);
 }
@@ -63,11 +65,13 @@ static void thread0_sched_entry(void)
 {
        /* TODO: support signal handling whenever we run a uthread */
        if (current_uthread) {
+               uthread_prep_pending_signals(current_uthread);
                run_current_uthread();
                assert(0);
        }
        while (1) {
                if (!thread0_info.is_blocked) {
+                       uthread_prep_pending_signals(thread0_uth);
                        run_uthread(thread0_uth);
                        assert(0);
                }