[Haskell-beginners] Signals and external bindings...
Antoine Latter
aslatter at gmail.com
Fri May 4 21:55:54 CEST 2012
On Fri, May 4, 2012 at 1:19 PM, Brandon Allbery <allbery.b at gmail.com> wrote:
> On Fri, May 4, 2012 at 1:26 PM, Mike Meyer <mwm at mired.org> wrote:
>>
>> 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?
>
>
> I'm not sure it *does* run. That is, I don't think a Haskell-based signal
> handler is even possible. When I talk about Haskell's signal handlers, I
> mean C handlers within the GHC runtime.
>
Well, there is this:
http://www.haskell.org/ghc/docs/latest/html/libraries/unix-2.5.1.0/System-Posix-Signals.html#g:4
But it's bit short on what exact semantics it provides. It looks like
it uses this chunk of code on GHC (on Posix systems):
https://github.com/ghc/ghc/blob/376210565e4dff2679246c6ebbcdbb3163c9e8a5/rts/posix/Signals.c
Antoine
More information about the Beginners
mailing list