diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2015-10-23 14:30:40 +0200 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2015-10-27 11:03:42 +0100 |
commit | 68b4238f4a1276a1f6f18430580b62dfa0420ffd (patch) | |
tree | 7e911d17dd254a51ddad12c4e6aa11303f060d9c | |
parent | 52f5af5c2f9cbeffb54c1ea3865703d986ecf29d (diff) | |
download | newlib-68b4238f4a1276a1f6f18430580b62dfa0420ffd.zip newlib-68b4238f4a1276a1f6f18430580b62dfa0420ffd.tar.gz newlib-68b4238f4a1276a1f6f18430580b62dfa0420ffd.tar.bz2 |
Clear pending signals targeting exiting thread
* cygtls.cc (_cygtls::remove): Call remove_pending_sigs.
* cygtls.h (_cygtls::remove_pending_sigs): Declare.
* sigproc.cc (pending_signals::clear): Define new method taking a
_cygtls pointer argument. Drop pending signals for that thread.
(_cygtls::remove_pending_sigs): Call pending_signals::clear for this
thread.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
-rw-r--r-- | winsup/cygwin/ChangeLog | 9 | ||||
-rw-r--r-- | winsup/cygwin/cygtls.cc | 1 | ||||
-rw-r--r-- | winsup/cygwin/cygtls.h | 1 | ||||
-rw-r--r-- | winsup/cygwin/sigproc.cc | 20 |
4 files changed, 30 insertions, 1 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index a95938d..696a435 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,12 @@ +2015-10-23 Corinna Vinschen <corinna@vinschen.de> + + * cygtls.cc (_cygtls::remove): Call remove_pending_sigs. + * cygtls.h (_cygtls::remove_pending_sigs): Declare. + * sigproc.cc (pending_signals::clear): Define new method taking a + _cygtls pointer argument. Drop pending signals for that thread. + (_cygtls::remove_pending_sigs): Call pending_signals::clear for this + thread. + 2015-10-22 Corinna Vinschen <corinna@vinschen.de> * common.din (aligned_alloc): Export. diff --git a/winsup/cygwin/cygtls.cc b/winsup/cygwin/cygtls.cc index cb8c24e..c94578f 100644 --- a/winsup/cygwin/cygtls.cc +++ b/winsup/cygwin/cygtls.cc @@ -187,6 +187,7 @@ _cygtls::remove (DWORD wait) /* FIXME: Need some sort of atthreadexit function to allow things like select to control this themselves. */ + remove_pending_sigs (); if (signal_arrived) { HANDLE h = signal_arrived; diff --git a/winsup/cygwin/cygtls.h b/winsup/cygwin/cygtls.h index c8615af..b386b98 100644 --- a/winsup/cygwin/cygtls.h +++ b/winsup/cygwin/cygtls.h @@ -267,6 +267,7 @@ public: void handle_SIGCONT (); private: void __reg3 call2 (DWORD (*) (void *, void *), void *, void *); + void remove_pending_sigs (); /*gentls_offsets*/ }; #pragma pack(pop) diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index 9f261c9..387a71a 100644 --- a/winsup/cygwin/sigproc.cc +++ b/winsup/cygwin/sigproc.cc @@ -79,7 +79,8 @@ public: void add (sigpacket&); bool pending () {retry = true; return !!start.next;} void clear (int sig) {sigs[sig].si.si_signo = 0;} - friend void __reg1 sig_dispatch_pending (bool);; + void clear (_cygtls *tls); + friend void __reg1 sig_dispatch_pending (bool); friend void WINAPI wait_sig (VOID *arg); friend void sigproc_init (); }; @@ -397,6 +398,23 @@ sig_clear (int sig) sigq.clear (sig); } +/* Clear pending signals of specific thread. Called from + _cygtls::remove_pending_sigs. */ +void +pending_signals::clear (_cygtls *tls) +{ + for (int sig = 0; sig < NSIG + 1; ++sig) + if (sigs[sig].sigtls == tls) + clear (sig); +} + +/* Clear pending signals of specific thread. Called from _cygtls::remove */ +void +_cygtls::remove_pending_sigs () +{ + sigq.clear (this); +} + extern "C" int sigpending (sigset_t *mask) { |