diff options
author | Christopher Faylor <me@cgf.cx> | 2011-08-01 04:02:04 +0400 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2011-08-01 04:02:04 +0400 |
commit | dc3dc49831af710f58f4e63f672ccd1d4bab83af (patch) | |
tree | def7eb0a15a01f4a4c3a87a5b39f855d49645314 /winsup/cygwin/sigproc.cc | |
parent | c1146045298c1bbd3c808fc8a4f5244a9dbaa9e4 (diff) |
* sigproc.cc (pending_signals::pending): Define new function.
(sig_dispatch_pending): Avoid calling sig_send if there are no pending signals.
Diffstat (limited to 'winsup/cygwin/sigproc.cc')
-rw-r--r-- | winsup/cygwin/sigproc.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index 8e458b9bf..fcd559b38 100644 --- a/winsup/cygwin/sigproc.cc +++ b/winsup/cygwin/sigproc.cc @@ -88,6 +88,7 @@ public: void reset () {curr = &start; prev = &start;} void add (sigpacket&); void del (); + bool pending () const {return !!start.next;} sigpacket *next (); sigpacket *save () const {return curr;} void restore (sigpacket *saved) {curr = saved;} @@ -431,7 +432,13 @@ sig_dispatch_pending (bool fast) return; } - sig_send (myself, fast ? __SIGFLUSHFAST : __SIGFLUSH); + /* Non-atomically test for any signals pending and wake up wait_sig if any are + found. It's ok if there's a race here since the next call to this function + should catch it. + FIXME: Eventually, wait_sig should wake up on its own to deal with pending + signals. */ + if (sigq.pending ()) + sig_send (myself, fast ? __SIGFLUSHFAST : __SIGFLUSH); } void __stdcall |