1 /* -----------------------------------------------------------------------------
2 * $Id: Schedule.h,v 1.7 1999/09/10 11:11:52 simonmar Exp $
4 * (c) The GHC Team 1998-1999
6 * Prototypes for functions in Schedule.c
7 * (RTS internal scheduler interface)
9 * ---------------------------------------------------------------------------*/
15 void initScheduler(void);
21 void awakenBlockedQueue(StgTSO *tso);
22 StgTSO *unblockOne(StgTSO *tso);
23 void initThread(StgTSO *tso, nat stack_size);
24 void interruptStgRts(void);
25 void raiseAsync(StgTSO *tso, StgClosure *exception);
27 extern nat context_switch;
29 void awaitEvent(rtsBool wait); /* In Select.c */
30 extern nat ticks_since_select; /* ditto */
32 extern StgTSO *run_queue_hd, *run_queue_tl;
33 extern StgTSO *blocked_queue_hd, *blocked_queue_tl;
36 extern void printThreadBlockage(StgTSO *tso);
39 #ifdef COMPILING_RTS_MAIN
40 extern DLLIMPORT StgTSO *MainTSO; /* temporary hack */
42 extern StgTSO *MainTSO; /* temporary hack */
44 #define END_TSO_QUEUE ((StgTSO *)(void*)&END_TSO_QUEUE_closure)
46 /* Add a thread to the end of the run queue.
47 * NOTE: tso->link should be END_TSO_QUEUE before calling this macro.
49 #define PUSH_ON_RUN_QUEUE(tso) \
50 if (run_queue_hd == END_TSO_QUEUE) { \
53 run_queue_tl->link = tso; \
57 #define PUSH_ON_BLOCKED_QUEUE(tso) \
58 if (blocked_queue_hd == END_TSO_QUEUE) { \
59 blocked_queue_hd = tso; \
61 blocked_queue_tl->link = tso; \
63 blocked_queue_tl = tso;
65 #define END_CAF_LIST stgCast(StgCAF*,(void*)&END_TSO_QUEUE_closure)