Add signal support to our basic thread0 scheduler
authorKevin Klues <klueska@cs.berkeley.edu>
Wed, 11 Nov 2015 08:43:59 +0000 (00:43 -0800)
committerBarret Rhoden <brho@cs.berkeley.edu>
Mon, 16 Nov 2015 23:15:03 +0000 (15:15 -0800)
As part of this, I needed to add an implementation of thread_paused()
since the signal stuff relies on this.  Since it would do nothing other
than call thread0_thread_runnable, I just reuse this function directly
in the function pointer table.

Signed-off-by: Kevin Klues <klueska@cs.berkeley.edu>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
user/parlib/thread0_sched.c

index a1525b5..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,
 };
 
@@ -64,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);
                }