rts: Add getPhysicalMemorySize
[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 #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 // Wakes up a thread on a Capability (probably a different Capability
25 // from the one held by the current Task).
26 //
27 #ifdef THREADED_RTS
28 void wakeupThreadOnCapability (Capability *cap,
29 Capability *other_cap,
30 StgTSO *tso);
31 #endif
32
33 void updateThunk (Capability *cap, StgTSO *tso,
34 StgClosure *thunk, StgClosure *val);
35
36 rtsBool removeThreadFromQueue (Capability *cap, StgTSO **queue, StgTSO *tso);
37 rtsBool removeThreadFromDeQueue (Capability *cap, StgTSO **head, StgTSO **tail, StgTSO *tso);
38
39 StgBool isThreadBound (StgTSO* tso);
40
41 // Overfow/underflow
42 void threadStackOverflow (Capability *cap, StgTSO *tso);
43 W_ threadStackUnderflow (Capability *cap, StgTSO *tso);
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"
53
54 #endif /* THREADS_H */