Weird behavior of the NonTermination exception

Bas van Dijk v.dijk.bas at
Fri May 4 16:18:21 CEST 2012

On 4 May 2012 14:12, Simon Marlow <marlowsd at> wrote:
> The forked thread is deadlocked, so the MVar is considered unreachable and
> the main thread is also unreachable.  Hence both threads get sent the
> exception.
> The RTS does this analysis using the GC, tracing the reachable objects
> starting from the roots.  It then send an exception to any threads which
> were not reachable, which in this case is both the main thread and the
> child, since neither is reachable.
> We (the user) knows that waking up the child thread will unblock the main
> thread, but the RTS doesn't know this, and it's not clear how it could find
> out easily (i.e. without multiple scans of the heap).

Thanks Simon, I learned something new today.



More information about the Glasgow-haskell-users mailing list