[Haskell-cafe] Waiting for async exception (and nothing else)
Silvio Frischknecht
silvio.frischi at gmail.com
Sat Aug 8 14:48:44 UTC 2015
> but this seems like a bit of a hack. Waiting on an otherwise-unused MVar
> or doing 'atomically retry' don't work because GHC kills them off
> straight away.
Not that this will help you any but this might actually be a bug.
From:
https://hackage.haskell.org/package/base-4.8.1.0/docs/Control-Concurrent.html
Holding a normal ThreadId reference will prevent the delivery of
BlockedIndefinitely exceptions because the reference could be used as
the target of throwTo at any time, which would unblock the thread.
So this will in fact run forever because threadId is still in scope.
main = do
threadId <-forkIO $ do
var <- newEmptyMVar
takeMVar var
forever $ threadDelay maxBound
so wouldn't it make sense to keep this alive
main = do
var <- newEmptyMVar
takeMVar var
because a user interrupt may ocure.
Silvio
More information about the Haskell-Cafe
mailing list