[commit: base] master: bugfix: use forkIOWithUnmask rather than forkIO (9b7bd85)
Simon Marlow
marlowsd at gmail.com
Wed Apr 11 17:19:51 CEST 2012
Repository : ssh://darcs.haskell.org//srv/darcs/packages/base
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/9b7bd85df24007e693c0c9b1e3303926cc9ad81d
>---------------------------------------------------------------
commit 9b7bd85df24007e693c0c9b1e3303926cc9ad81d
Author: Simon Marlow <marlowsd at gmail.com>
Date: Wed Apr 11 10:03:45 2012 +0100
bugfix: use forkIOWithUnmask rather than forkIO
>---------------------------------------------------------------
System/Timeout.hs | 11 ++++-------
1 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/System/Timeout.hs b/System/Timeout.hs
index 4114852..a72ec1a 100644
--- a/System/Timeout.hs
+++ b/System/Timeout.hs
@@ -25,12 +25,8 @@
module System.Timeout ( timeout ) where
#ifdef __GLASGOW_HASKELL__
-import Prelude (Show(show), IO, Ord((<)), Eq((==)), Int,
- otherwise, fmap)
-import Data.Maybe (Maybe(..))
-import Control.Monad (Monad(..))
-import Control.Concurrent (forkIO, threadDelay, myThreadId, killThread)
-import Control.Exception (Exception, handleJust, throwTo, bracket)
+import Control.Concurrent
+import Control.Exception (Exception, handleJust, bracket)
import Data.Typeable
import Data.Unique (Unique, newUnique)
@@ -86,7 +82,8 @@ timeout n f
ex <- fmap Timeout newUnique
handleJust (\e -> if e == ex then Just () else Nothing)
(\_ -> return Nothing)
- (bracket (forkIO (threadDelay n >> throwTo pid ex))
+ (bracket (forkIOWithUnmask $ \unmask ->
+ unmask $ threadDelay n >> throwTo pid ex)
(killThread)
(\_ -> fmap Just f))
#else
More information about the Cvs-libraries
mailing list