openFd under -threaded gets interrupted

Donn Cave donn at
Fri Dec 18 13:15:31 EST 2009

Quoth Mitar <mmitar at>,

> Also is there any workaround possible in Haskell/GHC? For example
> making time while openFd is in progress without interrupts?

You might try something like this:

    import System.Posix.Signals

        setSignalMask fullSignalSet
        fd <- openFd ...
        setSignalMask emptySignalSet

I'm not in a position to try it in exactly the same situation, but
I see that when I run with all signals blocked as above, after a while
I have a SIGALRM pending (with -threaded or not), so I reckon that might
be the signal used by the runtime thread manager.  If it works, I would
recommend blocking only that signal during the openFd, so for example
you'll be able to abort normally with SIGINT if the device is stuck.


More information about the Glasgow-haskell-users mailing list