00001 00007 /* Embedded XINU, Copyright (C) 2007. All rights reserved. */ 00008 00009 #include <kernel.h> 00010 #include <queue.h> 00011 #include <clock.h> 00012 00016 void wakeup(void) 00017 { 00018 /* wakeup all processes that have no more time to sleep */ 00019 while ( nonempty(sleepq) && (firstkey(sleepq) <= 0) ) 00020 { 00021 /* prepare the process, but we need to wake up all */ 00022 /* processes (possibly more important) which have lapsed */ 00023 ready(dequeue(sleepq), RESCHED_NO); 00024 } 00025 00026 /* All timed out processes are awake, a now awake process */ 00027 /* may be more important than the currently running process */ 00028 /* so we need a forced reschedule. */ 00029 resched(); 00030 return; 00031 }