rts: Add api to pin a thread to a numa node but without fixing a capability
[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 tryWakeupThread (Capability *cap, StgTSO *tso);
21 void migrateThread (Capability *from, StgTSO *tso, Capability *to);
22
23 // Wakes up a thread on a Capability (probably a different Capability
24 // from the one held by the current Task).
25 //
26 #ifdef THREADED_RTS
27 void wakeupThreadOnCapability (Capability *cap,
28 Capability *other_cap,
29 StgTSO *tso);
30 #endif
31
32 void updateThunk (Capability *cap, StgTSO *tso,
33 StgClosure *thunk, StgClosure *val);
34
35 rtsBool removeThreadFromQueue (Capability *cap, StgTSO **queue, StgTSO *tso);
36 rtsBool removeThreadFromDeQueue (Capability *cap, StgTSO **head, StgTSO **tail, StgTSO *tso);
37
38 StgBool isThreadBound (StgTSO* tso);
39
40 // Overfow/underflow
41 void threadStackOverflow (Capability *cap, StgTSO *tso);
42 W_ threadStackUnderflow (Capability *cap, StgTSO *tso);
43
44 rtsBool performTryPutMVar(Capability *cap, StgMVar *mvar, StgClosure *value);
45
46 #ifdef DEBUG
47 void printThreadBlockage (StgTSO *tso);
48 void printThreadStatus (StgTSO *t);
49 void printAllThreads (void);
50 void printThreadQueue (StgTSO *t);
51 #endif
52
53 #include "EndPrivate.h"
54
55 #endif /* THREADS_H */