Hi Robin,

Thanks for the pointer. I can't find the thread in question after a bit of googling, but suspect you mean using System.Mem.StableName? From the docs,

Stable names are reclaimed by the runtime system when they are no longer needed.

which seems like it's not going to work. It does point me towards the related Foreign.StablePtr which seems like it should do what I want.

Cheers,

David


On 6 August 2015 at 21:53, Robin Palotai <palotai.robin@gmail.com> wrote:

You can make a stable name for the MVar which will prevent the rts from collecting it. Google it, there was a thread about this with Simon Marlow.

Robin


On Wed, Aug 5, 2015, 12:43 PM David Turner <dct25-561bs@mythic-beasts.com> wrote:
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,


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe