From: sof Date: Thu, 18 Apr 2002 23:32:56 +0000 (+0000) Subject: [project @ 2002-04-18 23:32:56 by sof] X-Git-Tag: nhc98-1-18-release~1060 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=b287fe7fd5024b3b9cc693260ca32cc6af39f7b9;p=ghc-base.git [project @ 2002-04-18 23:32:56 by sof] re-added Show instance for ThreadId --- diff --git a/Control/Concurrent.hs b/Control/Concurrent.hs index f3a426e..8e82663 100644 --- a/Control/Concurrent.hs +++ b/Control/Concurrent.hs @@ -8,7 +8,7 @@ -- Stability : experimental -- Portability : non-portable -- --- $Id: Concurrent.hs,v 1.4 2002/04/10 15:57:16 simonmar Exp $ +-- $Id: Concurrent.hs,v 1.5 2002/04/18 23:32:56 sof Exp $ -- -- A common interface to a collection of useful concurrency -- abstractions. @@ -94,6 +94,13 @@ instance Eq ThreadId where instance Ord ThreadId where compare = cmpThread +foreign import ccall unsafe "rts_getThreadId" getThreadId :: Addr# -> Int + +instance Show ThreadId where + showsPrec d (ThreadId t) = + showString "ThreadId " . + showsPrec d (getThreadId (unsafeCoerce# t)) + forkIO :: IO () -> IO ThreadId forkIO action = IO $ \ s -> case (fork# action_plus s) of (# s1, id #) -> (# s1, ThreadId id #)