1 /* -----------------------------------------------------------------------------
2 * $Id: SchedAPI.h,v 1.5 1999/07/03 18:39:41 sof Exp $
4 * (c) The GHC Team 1998
6 * External API for the scheduler. For most uses, the functions in
7 * RtsAPI.h should be enough.
9 * ---------------------------------------------------------------------------*/
15 * Running the scheduler
20 Killed, /* another thread killed us */
21 Interrupted, /* stopped in response to a call to interruptStgRts */
23 AllBlocked, /* subtly different from Deadlock */
28 * schedule() plus the thread creation functions are not part
29 * part of the external RTS API, so leave them out if we're
30 * not compiling rts/ bits. -- sof 7/99
35 SchedulerStatus schedule(StgTSO *main_thread, /*out*/StgClosure **ret);
41 StgTSO *createThread (nat stack_size);
43 static inline void pushClosure (StgTSO *tso, StgClosure *c) {
48 static inline void pushRealWorld (StgTSO *tso) {
50 tso->sp[0] = (W_) REALWORLD_TAG;
52 static inline StgTSO *
53 createGenThread(nat stack_size, StgClosure *closure) {
55 t = createThread(stack_size);
56 pushClosure(t,closure);
60 static inline StgTSO *
61 createIOThread(nat stack_size, StgClosure *closure) {
63 t = createThread(stack_size);
65 pushClosure(t,closure);
70 * Same as above, but also evaluate the result of the IO action
71 * to whnf while we're at it.
74 static inline StgTSO *
75 createStrictIOThread(nat stack_size, StgClosure *closure) {
77 t = createThread(stack_size);
78 pushClosure(t,closure);
79 pushClosure(t,(StgClosure*)&forceIO_closure);
88 void deleteThread(StgTSO *tso);
94 void RevertCAFs(void);