Re-add blocked; it got lost in the extensible exceptions patches
authorIan Lynagh <igloo@earth.li>
Wed, 30 Jul 2008 14:56:14 +0000 (14:56 +0000)
committerIan Lynagh <igloo@earth.li>
Wed, 30 Jul 2008 14:56:14 +0000 (14:56 +0000)
Control/Exception.hs
GHC/IOBase.lhs

index c49b6b8..cd71313 100644 (file)
@@ -127,6 +127,7 @@ module Control.Exception (
 
 #ifdef __GLASGOW_HASKELL__
 import GHC.Base
+import GHC.IOBase
 import {-# SOURCE #-} GHC.Handle
 import GHC.List
 import GHC.Num
index 93c4065..58e5ec3 100644 (file)
@@ -44,7 +44,7 @@ module GHC.IOBase(
     stackOverflow, heapOverflow, ioException, 
     IOError, IOException(..), IOErrorType(..), ioError, userError,
     ExitCode(..),
-    throwIO, block, unblock, catchAny, catchException,
+    throwIO, block, unblock, blocked, catchAny, catchException,
     evaluate,
     ErrorCall(..), ArithException(..), AsyncException(..),
     BlockedOnDeadMVar(..), BlockedIndefinitely(..),
@@ -967,6 +967,12 @@ unblock :: IO a -> IO a
 
 block (IO io) = IO $ blockAsyncExceptions# io
 unblock (IO io) = IO $ unblockAsyncExceptions# io
+
+-- | returns True if asynchronous exceptions are blocked in the
+-- current thread.
+blocked :: IO Bool
+blocked = IO $ \s -> case asyncExceptionsBlocked# s of
+                        (# s', i #) -> (# s', i /=# 0# #)
 \end{code}
 
 \begin{code}