Fix building RTS with gcc 2.*; declare all variables at the top of a block
[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 #if defined(GRAN) || defined(PARALLEL_HASKELL)
13 StgBlockingQueueElement * unblockOne (StgBlockingQueueElement *bqe, 
14                                       StgClosure *node);
15 #else
16 StgTSO * unblockOne (Capability *cap, StgTSO *tso);
17 StgTSO * unblockOne_ (Capability *cap, StgTSO *tso, rtsBool allow_migrate);
18 #endif
19
20 #if defined(GRAN) || defined(PARALLEL_HASKELL)
21 void awakenBlockedQueue(StgBlockingQueueElement *q, StgClosure *node);
22 #else
23 void awakenBlockedQueue (Capability *cap, StgTSO *tso);
24 #endif
25
26 void removeThreadFromMVarQueue (StgMVar *mvar, StgTSO *tso);
27 void removeThreadFromQueue     (StgTSO **queue, StgTSO *tso);
28 void removeThreadFromDeQueue   (StgTSO **head, StgTSO **tail, StgTSO *tso);
29
30 StgBool isThreadBound (StgTSO* tso);
31
32 #ifdef DEBUG
33 void printThreadBlockage (StgTSO *tso);
34 void printThreadStatus (StgTSO *t);
35 void printAllThreads (void);
36 void printThreadQueue (StgTSO *t);
37 # if defined(PARALLEL_HASKELL)
38 void print_bq (StgClosure *node);
39 void print_bqe (StgBlockingQueueElement *bqe);
40 nat  run_queue_len (void);
41 # elif defined(GRAN)
42 void print_bq (StgClosure *node);
43 # endif
44 #endif
45
46 #endif /* THREADS_H */