1 /* -----------------------------------------------------------------------------
2 * $Id: SchedAPI.h,v 1.7 1999/11/02 15:05:52 simonmar 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 * schedule() plus the thread creation functions are not part
16 * part of the external RTS API, so leave them out if we're
17 * not compiling rts/ bits. -- sof 7/99
20 SchedulerStatus waitThread(StgTSO *main_thread, /*out*/StgClosure **ret);
26 StgTSO *createThread(nat stack_size);
27 void scheduleThread(StgTSO *tso);
29 static inline void pushClosure (StgTSO *tso, StgClosure *c) {
34 static inline void pushRealWorld (StgTSO *tso) {
36 tso->sp[0] = (W_) REALWORLD_TAG;
38 static inline StgTSO *
39 createGenThread(nat stack_size, StgClosure *closure) {
41 t = createThread(stack_size);
42 pushClosure(t,closure);
46 static inline StgTSO *
47 createIOThread(nat stack_size, StgClosure *closure) {
49 t = createThread(stack_size);
51 pushClosure(t,closure);
56 * Same as above, but also evaluate the result of the IO action
57 * to whnf while we're at it.
60 static inline StgTSO *
61 createStrictIOThread(nat stack_size, StgClosure *closure) {
63 t = createThread(stack_size);
64 pushClosure(t,closure);
65 pushClosure(t,(StgClosure*)&forceIO_closure);
74 void deleteThread(StgTSO *tso);
80 void RevertCAFs(void);