[project @ 2002-08-30 12:25:15 by stolz]
authorstolz <unknown>
Fri, 30 Aug 2002 12:25:15 +0000 (12:25 +0000)
committerstolz <unknown>
Fri, 30 Aug 2002 12:25:15 +0000 (12:25 +0000)
Express 'killThread' in terms of 'throwTo'

GHC/Conc.lhs

index 3c994f3..49689a3 100644 (file)
@@ -90,14 +90,14 @@ This misfeature will hopefully be corrected at a later date.
 not implemented in Hugs).  Any work already done by the thread isn\'t
 lost: the computation is suspended until required by another thread.
 The memory used by the thread will be garbage collected if it isn\'t
-referenced from anywhere.  The 'killThread' function may be defined in
+referenced from anywhere.  The 'killThread' function is defined in
 terms of 'throwTo':
 
->   killThread tid = throwTo tid (AsyncException ThreadKilled)
+> killThread tid = throwTo tid (AsyncException ThreadKilled)
+
 -}
 killThread :: ThreadId -> IO ()
-killThread (ThreadId id) = IO $ \ s ->
-   case (killThread# id (AsyncException ThreadKilled) s) of s1 -> (# s1, () #)
+killThread tid = throwTo tid (AsyncException ThreadKilled)
 
 {- | 'throwTo' raises an arbitrary exception in the target thread.