From 1c9b35dcdfbec4c68c65f770bb13e71617e919f9 Mon Sep 17 00:00:00 2001 From: Bas van Dijk Date: Mon, 29 Mar 2010 13:16:24 +0000 Subject: [PATCH] withThread: block asynchronous exceptions before installing exception handler. Note that I don't unblock the given io computation. Because AFAICS withThread is only called with 'waitFd' which only performs an FFI call which can't receive asynchronous exceptions anyway. --- Control/Concurrent.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Control/Concurrent.hs b/Control/Concurrent.hs index ce668fb..a25e659 100644 --- a/Control/Concurrent.hs +++ b/Control/Concurrent.hs @@ -482,7 +482,7 @@ foreign import ccall unsafe "rtsSupportsBoundThreads" threaded :: Bool withThread :: IO a -> IO a withThread io = do m <- newEmptyMVar - _ <- forkIO $ try io >>= putMVar m + _ <- block $ forkIO $ try io >>= putMVar m x <- takeMVar m case x of Right a -> return a -- 1.7.10.4