[Haskell-cafe] STM and garbage collector
tomas.carnecky at gmail.com
Sun Oct 18 09:45:52 UTC 2015
Who throws the exception? Documentation of `throwTo` sais that the calling
thread is blocked until the exception is delivered. If the target thread
has async exceptions masked then the exception is never delivered.
Does that also mean a blocked thread which has async exceptions masked is,
essentially, a resource leak?
On Sun, Oct 18, 2015 at 5:23 AM Michael Sloan <mgsloan at gmail.com> wrote:
> In this case, the GC will indeed find that no one has a reference to the
> thread. However, instead of garbage collecting the thread, the
> BlockedIndefinitely exception is thrown to it. So, it resumes execution of
> the thread with that exception.
> This also applies to threads blocked on MVars.
> On Sat, Oct 17, 2015 at 9:11 AM, Tomas Carnecky <tomas.carnecky at gmail.com>
>> If a thread is blocking indefinitely in an STM transaction (reading from
>> a queue to which nobody else has a reference and thus can not write into),
>> is the runtime smart enough to GC the thread? Or do I have to kill the
>> thread manually?
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe