/*
* Kernel threads
* Copyright (c) 2001,2003 David H. Hovemeyer <daveho@cs.umd.edu>
- * $Revision: 1.1 $
+ * $Revision: 1.4 $
*
* This is free software. You are permitted to use,
* redistribute, and modify it as specified in the file "COPYING".
#include <geekos/kthread.h>
#include <geekos/malloc.h>
#include <geekos/serial.h>
+#include <geekos/debug.h>
/* ----------------------------------------------------------------------
* Private data
* will "return", and then Schedule() will return to wherever
* it was called from.
*/
+
+ //SerialPrint("Switch_To_Thread() in Schedule()\n");
Switch_To_Thread(runnable);
}
}
}
+
+
+/*
+ * Wake up a single thread waiting on given wait queue
+ * (if there are any threads waiting). Chooses the highest priority thread.
+ * Interrupts must be disabled!
+ */
+void Wake_Up_Thread(struct Thread_Queue* waitQueue, int pid)
+{
+ struct Kernel_Thread* thread = Lookup_Thread(pid);;
+
+ KASSERT(!Interrupts_Enabled());
+
+
+ if (thread != 0) {
+ Remove_Thread(waitQueue, thread);
+ Make_Runnable(thread);
+ /*Print("Wake_Up_One: waking up %x from %x\n", best, g_currentThread); */
+ }
+}
+
+
+
+
/*
* Allocate a key for accessing thread-local data.
*/