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.
withThread :: IO a -> IO a
withThread io = do
m <- newEmptyMVar
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
x <- takeMVar m
case x of
Right a -> return a