Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2015-11-02 15:53:25 +0300
committerCorinna Vinschen <corinna@vinschen.de>2015-11-02 15:54:30 +0300
commit90b9303f0b43de0568606677cda779e781464a00 (patch)
treecfa066132e90232c83064742a29e0e1a747fdcde /winsup/cygwin/sigproc.cc
parentdf6206aa56a3ef34f8444fee7c777593eddedbbe (diff)
Fix incorrect implementation to clear per-thread pending signals
* sigproc.cc (class pending_signals): Drop sigproc_init friendship. (pending_signals::clear): Fix implementation to avoid subsequent endless loop in wait_sig. Improve comment. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'winsup/cygwin/sigproc.cc')
-rw-r--r--winsup/cygwin/sigproc.cc16
1 files changed, 11 insertions, 5 deletions
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index 387a71a69..fbc738d4f 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -82,7 +82,6 @@ public:
void clear (_cygtls *tls);
friend void __reg1 sig_dispatch_pending (bool);
friend void WINAPI wait_sig (VOID *arg);
- friend void sigproc_init ();
};
Static pending_signals sigq;
@@ -398,14 +397,21 @@ sig_clear (int sig)
sigq.clear (sig);
}
-/* Clear pending signals of specific thread. Called from
+/* Clear pending signals of specific thread. Called under TLS lock 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);
+ sigpacket *q = &start, *qnext;
+
+ while ((qnext = q->next))
+ {
+ if (qnext->sigtls == tls)
+ {
+ q->next = qnext->next;
+ qnext->si.si_signo = 0;
+ }
+ }
}
/* Clear pending signals of specific thread. Called from _cygtls::remove */