cpp: Use #pragma once instead of #ifndef guards
[ghc.git] / rts / Threads.h
1 /* ---------------------------------------------------------------------------
2 *
3 * (c) The GHC Team, 2006
4 *
5 * Thread-related functionality
6 *
7 * --------------------------------------------------------------------------*/
8
9 #pragma once
10
11 #include "BeginPrivate.h"
12
13 #define END_BLOCKED_EXCEPTIONS_QUEUE ((MessageThrowTo*)END_TSO_QUEUE)
14
15 StgTSO * unblockOne (Capability *cap, StgTSO *tso);
16 StgTSO * unblockOne_ (Capability *cap, StgTSO *tso, bool allow_migrate);
17
18 void checkBlockingQueues (Capability *cap, StgTSO *tso);
19 void tryWakeupThread (Capability *cap, StgTSO *tso);
20 void migrateThread (Capability *from, StgTSO *tso, Capability *to);
21
22 // Wakes up a thread on a Capability (probably a different Capability
23 // from the one held by the current Task).
24 //
25 #ifdef THREADED_RTS
26 void wakeupThreadOnCapability (Capability *cap,
27 Capability *other_cap,
28 StgTSO *tso);
29 #endif
30
31 void updateThunk (Capability *cap, StgTSO *tso,
32 StgClosure *thunk, StgClosure *val);
33
34 bool removeThreadFromQueue (Capability *cap, StgTSO **queue, StgTSO *tso);
35 bool removeThreadFromDeQueue (Capability *cap, StgTSO **head, StgTSO **tail, StgTSO *tso);
36
37 StgBool isThreadBound (StgTSO* tso);
38
39 // Overfow/underflow
40 void threadStackOverflow (Capability *cap, StgTSO *tso);
41 W_ threadStackUnderflow (Capability *cap, StgTSO *tso);
42
43 bool performTryPutMVar(Capability *cap, StgMVar *mvar, StgClosure *value);
44
45 #ifdef DEBUG
46 void printThreadBlockage (StgTSO *tso);
47 void printThreadStatus (StgTSO *t);
48 void printAllThreads (void);
49 void printThreadQueue (StgTSO *t);
50 #endif
51
52 #include "EndPrivate.h"