From 5f66ef1493463627b549c07abdb28d1b9ac92948 Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Wed, 30 Jul 2008 14:56:14 +0000 Subject: [PATCH] Re-add blocked; it got lost in the extensible exceptions patches --- Control/Exception.hs | 1 + GHC/IOBase.lhs | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Control/Exception.hs b/Control/Exception.hs index c49b6b8..cd71313 100644 --- a/Control/Exception.hs +++ b/Control/Exception.hs @@ -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 diff --git a/GHC/IOBase.lhs b/GHC/IOBase.lhs index 93c4065..58e5ec3 100644 --- a/GHC/IOBase.lhs +++ b/GHC/IOBase.lhs @@ -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} -- 1.7.10.4