can you block a thread in GHC by its threadID?

Simon Marlow simonmar at microsoft.com
Tue Jun 22 08:36:43 EDT 2004


On 22 June 2004 12:24, Volker Stolz wrote:

> In local.glasgow-haskell-users, you wrote:
>> On 22 June 2004 10:39, Bernard James POPE wrote:
>>> Supposing that such a thing is indeed possible is there any chance
>>> that it could be folded into GHC? (Then I wouldn't have to ship my
>>> own variant of the runtime with buddha.)
>> 
>> Certainly, I don't see any reason why not.  It looks like a bolt-on
>> extension rather than a global change.
> 
> A similar feature has been *removed* from Java recently for a good
> reason (rule of thumb: "If you used it, you did something wrong").
> OTOH I see that it's handy for debuggers.

I bet the reason was that they don't have a good handle on asynchronous
exceptions.

But that raises a good point: it shouldn't be possible to stop a thread
inside a block (i.e. Control.Exception.block).  So stopThread should
block until the target thread has actually stopped.  This means adding
the source thread to the blocked_exceptions list of the target thread.

Cheers,
	Simon


More information about the Glasgow-haskell-users mailing list