X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fgeekos%2Fkthread.c;h=6ecb30fd25e7a483adb5d74fa5a1c9a7c091b447;hb=856dabe4e139e3b42e2956f85e562aa922d66f2e;hp=1a677759650fb64489e35bdb54aec097aa60e7a6;hpb=3b49b57d1f3b8bccdf7390c26ea9cda1f8dac8c3;p=palacios.git diff --git a/palacios/src/geekos/kthread.c b/palacios/src/geekos/kthread.c index 1a67775..6ecb30f 100644 --- a/palacios/src/geekos/kthread.c +++ b/palacios/src/geekos/kthread.c @@ -1,7 +1,7 @@ /* * Kernel threads * Copyright (c) 2001,2003 David H. Hovemeyer - * $Revision: 1.3 $ + * $Revision: 1.4 $ * * This is free software. You are permitted to use, * redistribute, and modify it as specified in the file "COPYING". @@ -561,7 +561,7 @@ void Schedule(void) * it was called from. */ - SerialPrint("Switch_To_Thread() in Schedule()\n"); + //SerialPrint("Switch_To_Thread() in Schedule()\n"); Switch_To_Thread(runnable); } @@ -748,6 +748,30 @@ void Wake_Up_One(struct Thread_Queue* waitQueue) } } + + +/* + * 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. */