twittner/zeromq-haskell — pull request #20 by joell (2012-09-14 18:26:39+00:00)
Title: Improve zmq_term signal masking.

When masking signals around the call to zmq_term, it is desirable for
some signals not to be blocked, e.g., termination signals such as
SIGTERM. Given that zmq_term may linger on open sockets for some time, in some scenarios it may be necessary for an external process to abort that linger process without necessarily being so violent as sending a SIGKILL. For these reasons, in this commit I loosened the signal mask to exclude the following extreme-condition signals:

* SIGQUIT
* SIGILL
* SIGFPE
* SIGSEGV
* SIGTERM

Also, if signal handlers are set to SIG_IGN to mask the signals during
the execution of zmq_term, it is desirable that they be restored at its
completion. While in many applications the call to terminate the ZeroMQ
context will occur at application's end, there will be some which do
other computations after the context is released. Therefore, this
commit restores the signal handlers after zmq_term returns.