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