below is currently only available in the GHC runtime system when the runtime system
has been compiled using a special option.
-When recompiling GHC, use ./configure --enable-threaded-rts to enable this.
+When recompiling GHC, use .\/configure --enable-threaded-rts to enable this.
To find your GHC has already been compiled that way, use
'rtsSupportsBoundThreads' from GHCi.
runInUnboundThread :: IO a -> IO a
runInUnboundThread action = do
- bound <- isCurrentThreadBound
- if bound
- then do
- mv <- newEmptyMVar
- forkIO (Exception.try action >>= putMVar mv)
- takeMVar mv >>= \either -> case either of
- Left exception -> Exception.throw exception
- Right result -> return result
- else action
+ bound <- isCurrentThreadBound
+ if bound
+ then do
+ mv <- newEmptyMVar
+ forkIO (Exception.try action >>= putMVar mv)
+ takeMVar mv >>= \either -> case either of
+ Left exception -> Exception.throw exception
+ Right result -> return result
+ else action
#endif /* __GLASGOW_HASKELL__ */