[Haskell-cafe] Waiting for async exception (and nothing else)

David Turner dct25-561bs at mythic-beasts.com
Wed Aug 5 10:43:22 UTC 2015


Hi,

Is there an elegant way to have a thread wait for an async exception but
nothing else? I tend to do something like

    forever $ threadDelay 1000000000

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.

The context is when using an API that only has a 'withMyThingy' wrapper and
no explicit openMyThingy and closeMyThingy alternatives. Perhaps that's an
API problem and the only way to work around this is with something a bit
hacky?

Cheers,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20150805/947c033b/attachment.html>


More information about the Haskell-Cafe mailing list