[commit: packages/base] master: Clarify docs for throwTo wrt atomicity (#8432) (3782a25)
git at git.haskell.org
git
Sat Oct 12 05:56:11 UTC 2013
Repository : ssh://git at git.haskell.org/base
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/3782a25f36a21b2dbee62dcb0029eb2302abf2f7/base
>---------------------------------------------------------------
commit 3782a25f36a21b2dbee62dcb0029eb2302abf2f7
Author: Austin Seipp <aseipp at pobox.com>
Date: Fri Oct 11 22:07:40 2013 -0500
Clarify docs for throwTo wrt atomicity (#8432)
Authored-by: Bertram Felgenhauer <bertram.felgenhauer at gmail.com>
Signed-off-by: Austin Seipp <aseipp at pobox.com>
>---------------------------------------------------------------
3782a25f36a21b2dbee62dcb0029eb2302abf2f7
GHC/Conc/Sync.lhs | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/GHC/Conc/Sync.lhs b/GHC/Conc/Sync.lhs
index 12611f5..42d6c3d 100644
--- a/GHC/Conc/Sync.lhs
+++ b/GHC/Conc/Sync.lhs
@@ -334,11 +334,12 @@ killThread tid = throwTo tid ThreadKilled
{- | 'throwTo' raises an arbitrary exception in the target thread (GHC only).
+Exception delivery synchronizes between the source and target thread:
'throwTo' does not return until the exception has been raised in the
-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
+target thread. The calling thread can thus be certain that the target
+thread has received the exception. Exception delivery is also atomic
+with respect to other exceptions. Atomicity is a useful property to have
+when dealing with race conditions: e.g. 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.
More information about the ghc-commits
mailing list