X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FSchedule.h;h=06ff4cfa3240830af4894aa8003b59e75ed20423;hb=d1910765bed05ab31cf7f5c0d979aca812e94136;hp=adaf078e754b1944f3637fc3bc4776c9ea838151;hpb=e62487b8fa138b115fa72e422ca155ac492fc81e;p=ghc-hetmet.git diff --git a/ghc/rts/Schedule.h b/ghc/rts/Schedule.h index adaf078..06ff4cf 100644 --- a/ghc/rts/Schedule.h +++ b/ghc/rts/Schedule.h @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: Schedule.h,v 1.4 1999/03/02 20:04:04 sof Exp $ + * $Id: Schedule.h,v 1.8 1999/10/19 15:39:08 simonmar Exp $ * * (c) The GHC Team 1998-1999 * @@ -18,17 +18,24 @@ void initScheduler(void); * Miscellany */ -void awaken_blocked_queue(StgTSO *tso); - +void awakenBlockedQueue(StgTSO *tso); +StgTSO *unblockOne(StgTSO *tso); void initThread(StgTSO *tso, nat stack_size); - void interruptStgRts(void); +void raiseAsync(StgTSO *tso, StgClosure *exception); extern nat context_switch; +void awaitEvent(rtsBool wait); /* In Select.c */ +extern nat ticks_since_select; /* ditto */ + extern StgTSO *run_queue_hd, *run_queue_tl; extern StgTSO *blocked_queue_hd, *blocked_queue_tl; +#ifdef DEBUG +extern void printThreadBlockage(StgTSO *tso); +#endif + #ifdef COMPILING_RTS_MAIN extern DLLIMPORT StgTSO *MainTSO; /* temporary hack */ #else @@ -36,12 +43,25 @@ extern StgTSO *MainTSO; /* temporary hack */ #endif #define END_TSO_QUEUE ((StgTSO *)(void*)&END_TSO_QUEUE_closure) +/* Add a thread to the end of the run queue. + * NOTE: tso->link should be END_TSO_QUEUE before calling this macro. + */ #define PUSH_ON_RUN_QUEUE(tso) \ - if (run_queue_hd == END_TSO_QUEUE) { \ + ASSERT(tso->link == END_TSO_QUEUE); \ + if (run_queue_hd == END_TSO_QUEUE) { \ run_queue_hd = tso; \ } else { \ run_queue_tl->link = tso; \ } \ run_queue_tl = tso; +#define PUSH_ON_BLOCKED_QUEUE(tso) \ + ASSERT(tso->link == END_TSO_QUEUE); \ + if (blocked_queue_hd == END_TSO_QUEUE) { \ + blocked_queue_hd = tso; \ + } else { \ + blocked_queue_tl->link = tso; \ + } \ + blocked_queue_tl = tso; + #define END_CAF_LIST stgCast(StgCAF*,(void*)&END_TSO_QUEUE_closure)