From: simonmar Date: Tue, 25 Oct 2005 09:01:48 +0000 (+0000) Subject: [project @ 2005-10-25 09:01:48 by simonmar] X-Git-Tag: Initial_conversion_from_CVS_complete~35 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=d86967d1e858adc01826bb7fa061996628dd5f97;p=ghc-base.git [project @ 2005-10-25 09:01:48 by simonmar] Note that throwTo blocks if the target thread is in a foreign call. --- diff --git a/GHC/Conc.lhs b/GHC/Conc.lhs index 026aff5..28a2016 100644 --- a/GHC/Conc.lhs +++ b/GHC/Conc.lhs @@ -146,7 +146,13 @@ target thread. The calling thread can thus be certain that the target thread has received the exception. This is a useful property to know when dealing with race conditions: eg. if there are two threads that can kill each other, it is guaranteed that only one of the threads -will get to kill the other. -} +will get to kill the other. + +If the target thread is currently making a foreign call, then the +exception will not be raised (and hence 'throwTo' will not return) +until the call has completed. This is the case regardless of whether +the call is inside a 'block' or not. + -} throwTo :: ThreadId -> Exception -> IO () throwTo (ThreadId id) ex = IO $ \ s -> case (killThread# id ex s) of s1 -> (# s1, () #)