2 issues and 1 proposal for runInUnboundThread

Bas van Dijk v.dijk.bas at gmail.com
Sat Oct 16 11:11:38 EDT 2010


On Fri, Oct 15, 2010 at 12:00 AM, Bas van Dijk <v.dijk.bas at gmail.com> wrote:
> When you throw an asynchronous exception to a thread which is
> executing: `runInUnboundThread m`, m will keep executing and there's
> no way to kill it.

I realize this isn't true. It's easy to kill 'm':

import Control.Concurrent
main = do mv <- newEmptyMVar
          let m = myThreadId >>= putMVar mv
          runInUnboundThread m
          takeMVar mv >>= killThread

However I still believe my proposed version is better because I see
`runInUnboundThread m` as just an optimized version of 'm'. In this
perspective, `runInUnboundThread m` should behave as 'm' as much as
possible. This means that asynchronous exception thrown to
`runInUnboundThread m` should be thrown to 'm'.

Bas


More information about the Libraries mailing list