]> granicus.if.org Git - libevent/commit
Make default signal backend fully threadsafe
authorNick Mathewson <nickm@torproject.org>
Wed, 15 Sep 2010 05:40:02 +0000 (01:40 -0400)
committerNick Mathewson <nickm@torproject.org>
Wed, 15 Sep 2010 05:40:02 +0000 (01:40 -0400)
commit95a7d418ab4ff332bc299813e6fc83c9be4ed0ec
tree03f93c6e972cdf3c54d8a5219a86203881cdaf24
parent720bd933c8a4e9f0b850be075e055eea98767665
Make default signal backend fully threadsafe

Jason Toffaletti discovered with helgrind that our signal handler was
messing with evsig_base, which can be set from lots of places in the
code.  Ordinarly, we'd just stick a lock on it, except that it is
illegal (and genuinely error-prone) to call pthread_mutex_acquire()
from inside a signal handler.

The solution is to only store the fd we write to in a static variable,
write the signal number to the fd, and put evsig_cb in charge of
activating signal events.

I have no idea how we'll cope if we want to enable this to handle
siginfo (where available) in the future.
evsignal-internal.h
signal.c