summaryrefslogtreecommitdiff
path: root/libraries/base/GHC/IO
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2010-07-08 15:27:35 +0000
committerSimon Marlow <marlowsd@gmail.com>2010-07-08 15:27:35 +0000
commit73157075b708095b14a8551ca2f296a8b4f2550b (patch)
treeb38aa88732e04ebf6e859423ed5f3a592a3313f9 /libraries/base/GHC/IO
parent3ae2fa064d02837651c305f2e8815e5e1e614029 (diff)
downloadhaskell-73157075b708095b14a8551ca2f296a8b4f2550b.tar.gz
New asynchronous exception control API (base parts)
As discussed on the libraries/haskell-cafe mailing lists http://www.haskell.org/pipermail/libraries/2010-April/013420.html This is a replacement for block/unblock in the asychronous exceptions API to fix a problem whereby a function could unblock asynchronous exceptions even if called within a blocked context. The new terminology is "mask" rather than "block" (to avoid confusion due to overloaded meanings of the latter). The following is the new API; the old API is deprecated but still available for the time being. Control.Exception ----------------- mask :: ((forall a. IO a -> IO a) -> IO b) -> IO b mask_ :: IO a -> IO a uninterruptibleMask :: ((forall a. IO a -> IO a) -> IO b) -> IO b uninterruptibleMask_ :: IO a -> IO getMaskingState :: IO MaskingState data MaskingState = Unmasked | MaskedInterruptible | MaskedUninterruptible Control.Concurrent ------------------ forkIOUnmasked :: IO () -> IO ThreadId
Diffstat (limited to 'libraries/base/GHC/IO')
-rw-r--r--libraries/base/GHC/IO/Handle/Internals.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/libraries/base/GHC/IO/Handle/Internals.hs b/libraries/base/GHC/IO/Handle/Internals.hs
index 2c0523f901..5568855ad4 100644
--- a/libraries/base/GHC/IO/Handle/Internals.hs
+++ b/libraries/base/GHC/IO/Handle/Internals.hs
@@ -124,7 +124,7 @@ withHandle fun h@(DuplexHandle _ m _) act = withHandle' fun h m act
withHandle' :: String -> Handle -> MVar Handle__
-> (Handle__ -> IO (Handle__,a)) -> IO a
withHandle' fun h m act =
- block $ do
+ mask_ $ do
(h',v) <- do_operation fun h act m
checkHandleInvariants h'
putMVar m h'
@@ -149,7 +149,7 @@ withAllHandles__ fun h@(DuplexHandle _ r w) act = do
withHandle__' :: String -> Handle -> MVar Handle__ -> (Handle__ -> IO Handle__)
-> IO ()
withHandle__' fun h m act =
- block $ do
+ mask_ $ do
h' <- do_operation fun h act m
checkHandleInvariants h'
putMVar m h'