f6d2dfd11a5d4c5adb8fc417f48bdfd2728365d2
[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 StgTSO * unblockOne (Capability *cap, StgTSO *tso);
13 StgTSO * unblockOne_ (Capability *cap, StgTSO *tso, rtsBool allow_migrate);
14
15 void awakenBlockedQueue (Capability *cap, StgTSO *tso);
16
17 void removeThreadFromMVarQueue (Capability *cap, StgMVar *mvar, StgTSO *tso);
18 void removeThreadFromQueue     (Capability *cap, StgTSO **queue, StgTSO *tso);
19 void removeThreadFromDeQueue   (Capability *cap, StgTSO **head, StgTSO **tail, StgTSO *tso);
20
21 StgBool isThreadBound (StgTSO* tso);
22
23 #ifdef DEBUG
24 void printThreadBlockage (StgTSO *tso);
25 void printThreadStatus (StgTSO *t);
26 void printAllThreads (void);
27 void printThreadQueue (StgTSO *t);
28 # if defined(PARALLEL_HASKELL)
29 void print_bq (StgClosure *node);
30 void print_bqe (StgBlockingQueueElement *bqe);
31 nat  run_queue_len (void);
32 # elif defined(GRAN)
33 void print_bq (StgClosure *node);
34 # endif
35 #endif
36
37 #endif /* THREADS_H */