1 /* -----------------------------------------------------------------------------
2 * $Id: Schedule.h,v 1.6 1999/08/25 16:11:51 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 #define PUSH_ON_RUN_QUEUE(tso) \
47 if (run_queue_hd == END_TSO_QUEUE) { \
50 run_queue_tl->link = tso; \
54 #define PUSH_ON_BLOCKED_QUEUE(tso) \
55 if (blocked_queue_hd == END_TSO_QUEUE) { \
56 blocked_queue_hd = tso; \
58 blocked_queue_tl->link = tso; \
60 blocked_queue_tl = tso;
62 #define END_CAF_LIST stgCast(StgCAF*,(void*)&END_TSO_QUEUE_closure)