[project @ 2005-01-28 12:55:17 by simonmar]
[ghc-hetmet.git] / ghc / rts / Exception.h
1 /* -----------------------------------------------------------------------------
2  *
3  * (c) The GHC Team, 1998-2000
4  *
5  * Exception support
6  *
7  * ---------------------------------------------------------------------------*/
8
9 extern const StgRetInfoTable stg_blockAsyncExceptionszh_ret_info;
10 extern const StgRetInfoTable stg_unblockAsyncExceptionszh_ret_info;
11
12 /* Determine whether a thread is interruptible (ie. blocked
13  * indefinitely).  Interruptible threads can be sent an exception with
14  * killThread# even if they have async exceptions blocked.
15  */
16 INLINE_HEADER int
17 interruptible(StgTSO *t)
18 {
19   switch (t->why_blocked) {
20   case BlockedOnMVar:
21   case BlockedOnException:
22   case BlockedOnRead:
23   case BlockedOnWrite:
24 #if defined(mingw32_HOST_OS)
25   case BlockedOnDoProc:
26 #endif
27   case BlockedOnDelay:
28     return 1;
29   // NB. Threaded blocked on foreign calls (BlockedOnCCall) are
30   // *not* interruptible.  We can't send these threads an exception.
31   default:
32     return 0;
33   }
34 }
35