On Fri, 4 May 2012 12:54:00 -0400 Brandon Allbery <allbery.b@gmail.com> wrote:
What the OP wants is for a signal to abort the C function and return control to the Haskell or Python runtime.
Not quite. What I want is for my code in Haskell or Python to run when the signal arrives (basically, on the signal handler), as opposed to waiting until the C code returns control to the Haskell or Python runtime But that's just the first step.
Do you understand why this requires arbitrary cleanup capability to be safe?
Well, it's clear to me that what I want to do requires arbitrary cleanup capabilities. If the C library doesn't provide a mechanism to shut itself down cleanly, nothing will work. But I realized I never got a more fundamental question answered: when does a signal handler written in Haskell run? Is it like C, in that it runs when the signal arrives, even if I'm currently executing some wrapped C code, and I have to deal with funky rules about what it can do? Or is it like Python, and it will run the first time the Haskell runtime gets control after the signal arrives? Thanks, <mike -- Mike Meyer <mwm@mired.org> http://www.mired.org/ Independent Software developer/SCM consultant, email for more information. O< ascii ribbon campaign - stop html mail - www.asciiribbon.org