/* The waitUntil call back function */ void callBack (int whichThread) { IntStatus oldLevel = interrupt->SetLevel(IntOff); scheduler->ReadyToRun(this); (void) interrupt->SetLevel(oldLevel); } /* Sleep for a certain number of ticks */ void waitUntil (int ticks) { IntStatus oldLevel = interrupt->SetLevel (IntOff); interrupt->Schedule(callBack,(int)currentThread,ticks,TimerInt); currentThread->Sleep(); interrupt->SetLevel (oldLevel); }