From 92244c68d06cedaaf9970a52916f921af4b7a474 Mon Sep 17 00:00:00 2001 From: simonmar Date: Thu, 1 Dec 2005 12:37:23 +0000 Subject: [PATCH] [project @ 2005-12-01 12:37:23 by simonmar] oops, forgot to remove forkIO from here --- Control/Concurrent.hs | 32 ++------------------------------ 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/Control/Concurrent.hs b/Control/Concurrent.hs index 6fddd7a..fb9747d 100644 --- a/Control/Concurrent.hs +++ b/Control/Concurrent.hs @@ -92,7 +92,8 @@ import Control.Exception as Exception #ifdef __GLASGOW_HASKELL__ import GHC.Conc ( ThreadId(..), myThreadId, killThread, yield, - threadDelay, threadWaitRead, threadWaitWrite ) + threadDelay, threadWaitRead, threadWaitWrite, + forkIO, childHandler ) import GHC.TopHandler ( reportStackOverflow, reportError ) import GHC.IOBase ( IO(..) ) import GHC.IOBase ( unsafeInterleaveIO ) @@ -204,35 +205,6 @@ instance Show ThreadId where showString "ThreadId " . showsPrec d (getThreadId (id2TSO t)) -{- | -This sparks off a new thread to run the 'IO' computation passed as the -first argument, and returns the 'ThreadId' of the newly created -thread. - -The new thread will be a lightweight thread; if you want to use a foreign -library that uses thread-local storage, use 'forkOS' instead. --} -forkIO :: IO () -> IO ThreadId -forkIO action = IO $ \ s -> - case (fork# action_plus s) of (# s1, id #) -> (# s1, ThreadId id #) - where - action_plus = Exception.catch action childHandler - -childHandler :: Exception -> IO () -childHandler err = Exception.catch (real_handler err) childHandler - -real_handler :: Exception -> IO () -real_handler ex = - case ex of - -- ignore thread GC and killThread exceptions: - BlockedOnDeadMVar -> return () - BlockedIndefinitely -> return () - AsyncException ThreadKilled -> return () - - -- report all others: - AsyncException StackOverflow -> reportStackOverflow - other -> reportError other - #endif /* __GLASGOW_HASKELL__ */ #ifndef __HUGS__ -- 1.7.10.4