schedule: set thread to NULL when there is no next thread
authorBrian Norris <banorris@uci.edu>
Sat, 10 Mar 2012 00:49:03 +0000 (16:49 -0800)
committerBrian Norris <banorris@uci.edu>
Sat, 10 Mar 2012 00:49:03 +0000 (16:49 -0800)
schedule.c

index f5ce644810856b06b3002996a1d95c1e11f17b9d..a4613c597f95d3362888df1ba6051fbbb1d75a58 100644 (file)
@@ -32,8 +32,10 @@ static void enqueue_thread(struct thread *t)
 
 static int dequeue_thread(struct thread **t)
 {
-       if (!head)
+       if (!head) {
+               *t = NULL;
                return -1;
+       }
        *t = head->this;
        head->live = 0;
        if (head == tail)