projects
/
ghc-base.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
595f2cb
)
Use throwIO instead of throw in runInBoundThread and runInUnboundThread
author
Bas van Dijk
<v.dijk.bas@gmail.com>
Thu, 14 Oct 2010 21:05:46 +0000
(21:05 +0000)
committer
Bas van Dijk
<v.dijk.bas@gmail.com>
Thu, 14 Oct 2010 21:05:46 +0000
(21:05 +0000)
Control/Concurrent.hs
patch
|
blob
|
history
diff --git
a/Control/Concurrent.hs
b/Control/Concurrent.hs
index
6122a10
..
f509bc0
100644
(file)
--- a/
Control/Concurrent.hs
+++ b/
Control/Concurrent.hs
@@
-406,13
+406,10
@@
runInBoundThread action
else do
ref <- newIORef undefined
let action_plus = Exception.try action >>= writeIORef ref
else do
ref <- newIORef undefined
let action_plus = Exception.try action >>= writeIORef ref
- resultOrException <-
- bracket (newStablePtr action_plus)
- freeStablePtr
- (\cEntry -> forkOS_entry_reimported cEntry >> readIORef ref)
- case resultOrException of
- Left exception -> Exception.throw (exception :: SomeException)
- Right result -> return result
+ bracket (newStablePtr action_plus)
+ freeStablePtr
+ (\cEntry -> forkOS_entry_reimported cEntry >> readIORef ref) >>=
+ unsafeResult
| otherwise = failNonThreaded
{- |
| otherwise = failNonThreaded
{- |
@@
-437,11
+434,11
@@
runInUnboundThread action = do
_ <- mask $ \restore -> forkIO $
Exception.try (if b then action else restore action) >>=
putMVar mv
_ <- mask $ \restore -> forkIO $
Exception.try (if b then action else restore action) >>=
putMVar mv
- takeMVar mv >>= \ei -> case ei of
- Left exception -> Exception.throw (exception :: SomeException)
- Right result -> return result
+ takeMVar mv >>= unsafeResult
else action
else action
+unsafeResult :: Either SomeException a -> IO a
+unsafeResult = either Exception.throwIO return
#endif /* __GLASGOW_HASKELL__ */
#ifdef __GLASGOW_HASKELL__
#endif /* __GLASGOW_HASKELL__ */
#ifdef __GLASGOW_HASKELL__