Use message-passing to implement throwTo in the RTS
[ghc.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 BEGIN_RTS_PRIVATE
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 awakenBlockedQueue (Capability *cap, StgTSO *tso);
20
21 void removeThreadFromMVarQueue (Capability *cap, StgMVar *mvar, StgTSO *tso);
22 void removeThreadFromQueue (Capability *cap, StgTSO **queue, StgTSO *tso);
23 void removeThreadFromDeQueue (Capability *cap, StgTSO **head, StgTSO **tail, StgTSO *tso);
24
25 StgBool isThreadBound (StgTSO* tso);
26
27 #ifdef DEBUG
28 void printThreadBlockage (StgTSO *tso);
29 void printThreadStatus (StgTSO *t);
30 void printAllThreads (void);
31 void printThreadQueue (StgTSO *t);
32 #endif
33
34 END_RTS_PRIVATE
35
36 #endif /* THREADS_H */