Add warning comment about Mach-O section name hack.
[ghc.git] / rts / RaiseAsync.h
1 /* ---------------------------------------------------------------------------
2 *
3 * (c) The GHC Team, 1998-2006
4 *
5 * Asynchronous exceptions
6 *
7 * --------------------------------------------------------------------------*/
8
9 #ifndef RAISEASYNC_H
10 #define RAISEASYNC_H
11
12 #define THROWTO_SUCCESS 0
13 #define THROWTO_BLOCKED 1
14
15 #ifndef CMINUSMINUS
16
17 #include "BeginPrivate.h"
18
19 void throwToSingleThreaded (Capability *cap,
20 StgTSO *tso,
21 StgClosure *exception);
22
23 void throwToSingleThreaded_ (Capability *cap,
24 StgTSO *tso,
25 StgClosure *exception,
26 rtsBool stop_at_atomically);
27
28 void suspendComputation (Capability *cap,
29 StgTSO *tso,
30 StgUpdateFrame *stop_here);
31
32 MessageThrowTo *throwTo (Capability *cap, // the Capability we hold
33 StgTSO *source,
34 StgTSO *target,
35 StgClosure *exception); // the exception closure
36
37 nat throwToMsg (Capability *cap,
38 MessageThrowTo *msg);
39
40 int maybePerformBlockedException (Capability *cap, StgTSO *tso);
41 void awakenBlockedExceptionQueue (Capability *cap, StgTSO *tso);
42
43 /* Determine whether a thread is interruptible (ie. blocked
44 * indefinitely). Interruptible threads can be sent an exception with
45 * killThread# even if they have async exceptions blocked.
46 */
47 INLINE_HEADER int
48 interruptible(StgTSO *t)
49 {
50 switch (t->why_blocked) {
51 case BlockedOnMVar:
52 case BlockedOnMVarRead:
53 case BlockedOnMsgThrowTo:
54 case BlockedOnRead:
55 case BlockedOnWrite:
56 #if defined(mingw32_HOST_OS)
57 case BlockedOnDoProc:
58 #endif
59 case BlockedOnDelay:
60 return 1;
61 // NB. Threaded blocked on foreign calls (BlockedOnCCall) are
62 // *not* interruptible. We can't send these threads an exception.
63 default:
64 return 0;
65 }
66 }
67
68 #include "EndPrivate.h"
69
70 #endif /* CMINUSMINUS */
71
72 #endif /* RAISEASYNC_H */
73