Commit c5b5811c authored by simonmar's avatar simonmar
Browse files

[project @ 1999-07-06 15:24:01 by simonmar]

Add a note about @raiseInThread@.
parent e8876154
......@@ -85,6 +85,26 @@ 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 else.
More generally, an arbitrary exception may be raised in any thread for
which we have a <tt/ThreadId/, with <tt/raiseInThread/:
raiseInThread :: ThreadId -> Exception -> IO ()
Actually <tt/killThread/ just raises the <tt/ThreadKilled/ exception
in the target thread, the normal action of which is to just terminate
the thread. The target thread will stop whatever it was doing (even
if it was blocked on an <tt/MVar/ or other computation) and handle the
The <tt/ThreadId/ for the current thread can be obtained with
myThreadId :: IO ThreadId
NOTE: if you have a @ThreadId@, you essentially have a pointer to the
thread itself. This means the thread itself can't be garbage
collected until you drop the @ThreadId@. This misfeature will
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment