move CHECKED settings to the right place
[ghc-hetmet.git] / rts / Threads.h
1 /* ---------------------------------------------------------------------------
2  *
3  * (c) The GHC Team, 2006
4  *
5  * Thread-related functionality
6  *
7  * --------------------------------------------------------------------------*/
8
9 #ifndef THREADS_H
10 #define THREADS_H
11
12 #include "BeginPrivate.h"
13
14 #define END_BLOCKED_EXCEPTIONS_QUEUE ((MessageThrowTo*)END_TSO_QUEUE)
15
16 StgTSO * unblockOne (Capability *cap, StgTSO *tso);
17 StgTSO * unblockOne_ (Capability *cap, StgTSO *tso, rtsBool allow_migrate);
18
19 void checkBlockingQueues (Capability *cap, StgTSO *tso);
20 void wakeBlockingQueue   (Capability *cap, StgBlockingQueue *bq);
21 void tryWakeupThread     (Capability *cap, StgTSO *tso);
22 void migrateThread       (Capability *from, StgTSO *tso, Capability *to);
23
24 // like tryWakeupThread(), but assumes the TSO is not ThreadRelocated
25 void tryWakeupThread_    (Capability *cap, StgTSO *tso);
26
27 // Wakes up a thread on a Capability (probably a different Capability
28 // from the one held by the current Task).
29 //
30 #ifdef THREADED_RTS
31 void wakeupThreadOnCapability (Capability *cap,
32                                Capability *other_cap, 
33                                StgTSO *tso);
34 #endif
35
36 void updateThunk         (Capability *cap, StgTSO *tso,
37                           StgClosure *thunk, StgClosure *val);
38
39 rtsBool removeThreadFromQueue     (Capability *cap, StgTSO **queue, StgTSO *tso);
40 rtsBool removeThreadFromDeQueue   (Capability *cap, StgTSO **head, StgTSO **tail, StgTSO *tso);
41
42 StgBool isThreadBound (StgTSO* tso);
43
44 #ifdef DEBUG
45 void printThreadBlockage (StgTSO *tso);
46 void printThreadStatus (StgTSO *t);
47 void printAllThreads (void);
48 void printThreadQueue (StgTSO *t);
49 #endif
50
51 #include "EndPrivate.h"
52
53 #endif /* THREADS_H */