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