Make tidyProgram discard speculative specialisation rules
[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 blockedThrowTo (Capability *cap,
20 StgTSO *target, MessageThrowTo *msg);
21
22 void throwToSingleThreaded (Capability *cap,
23 StgTSO *tso,
24 StgClosure *exception);
25
26 void throwToSingleThreaded_ (Capability *cap,
27 StgTSO *tso,
28 StgClosure *exception,
29 rtsBool stop_at_atomically);
30
31 void suspendComputation (Capability *cap,
32 StgTSO *tso,
33 StgUpdateFrame *stop_here);
34
35 MessageThrowTo *throwTo (Capability *cap, // the Capability we hold
36 StgTSO *source,
37 StgTSO *target,
38 StgClosure *exception); // the exception closure
39
40 nat throwToMsg (Capability *cap,
41 MessageThrowTo *msg);
42
43 int maybePerformBlockedException (Capability *cap, StgTSO *tso);
44 void awakenBlockedExceptionQueue (Capability *cap, StgTSO *tso);
45
46 /* Determine whether a thread is interruptible (ie. blocked
47 * indefinitely). Interruptible threads can be sent an exception with
48 * killThread# even if they have async exceptions blocked.
49 */
50 INLINE_HEADER int
51 interruptible(StgTSO *t)
52 {
53 switch (t->why_blocked) {
54 case BlockedOnMVar:
55 case BlockedOnSTM:
56 case BlockedOnMVarRead:
57 case BlockedOnMsgThrowTo:
58 case BlockedOnRead:
59 case BlockedOnWrite:
60 #if defined(mingw32_HOST_OS)
61 case BlockedOnDoProc:
62 #endif
63 case BlockedOnDelay:
64 return 1;
65 // NB. Threaded blocked on foreign calls (BlockedOnCCall) are
66 // *not* interruptible. We can't send these threads an exception.
67 default:
68 return 0;
69 }
70 }
71
72 #include "EndPrivate.h"
73
74 #endif /* CMINUSMINUS */
75
76 #endif /* RAISEASYNC_H */
77
78
79 // Local Variables:
80 // mode: C
81 // fill-column: 80
82 // indent-tabs-mode: nil
83 // c-basic-offset: 4
84 // buffer-file-coding-system: utf-8-unix
85 // End: