[Ecls-list] Threads and signal masks (Was: Special symbols ... locking or thread-local bindings)
Juan Jose Garcia-Ripoll
juanjose.garciaripoll at googlemail.com
Tue Aug 2 20:06:41 UTC 2011
On Mon, Aug 1, 2011 at 11:45 PM, Matthew Mondor <mm_lists at pulsar-zone.net>wrote:
> BTW, is there a facility already present in ECL so that I can in the
> top-level decide which unix signal to ignore (a-la sigaction(2)
> SIG_IGN), and block/unblock it on a per-thread basis (i.e. a-la
> pthread_sigmask(3))? Or must my code use inline C as necessary to do
> this? I guess that such code would have no relevance on non-POSIX OSs
> though...
ECL has a function, EXT:CATCH-SIGNAL, which takes two arguments: a signal
constant and a flag (T/NIL), activating or deactivating that signal
globally. Today I did two things: one is to add a :LOCAL keyword argument to
have the action take place only on the current thread, and export the signal
constants from the EXT package.
Sample use
(ext:catch-signal ext:+sigpipe+ nil) ;; Global
(ext:catch-signal ext:+sigpipe+ nil :local t) ;; Thread local
Could you please test it and report whether it works sufficiently well for
your purposes?
Juanjo
--
Instituto de Física Fundamental, CSIC
c/ Serrano, 113b, Madrid 28006 (Spain)
http://juanjose.garciaripoll.googlepages.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20110802/71433175/attachment.html>
More information about the ecl-devel
mailing list