withThread: block asynchronous exceptions before installing exception handler.
authorBas van Dijk <v.dijk.bas@gmail.com>
Mon, 29 Mar 2010 13:16:24 +0000 (13:16 +0000)
committerBas van Dijk <v.dijk.bas@gmail.com>
Mon, 29 Mar 2010 13:16:24 +0000 (13:16 +0000)
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

index ce668fb..a25e659 100644 (file)
@@ -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