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:
authorChristopher Faylor <me@cgf.cx>2013-05-16 09:36:15 +0400
committerChristopher Faylor <me@cgf.cx>2013-05-16 09:36:15 +0400
commitdae40103a5e4430cb836c731c8b5aee0ca115d3b (patch)
tree370c2b007fd97b1f39e4f0ac73be9e675047b423 /winsup/cygwin/sigproc.cc
parent58854fc721f5f22886c1f2d381c550aff5ec44f5 (diff)
* sigproc.cc (sig_hold): Delete.
(sigheld): Delete. (sig_send): Eliminate special-case __SIGHOLD handling. (wait_sig): Just flag when signals are on hold and add them to the queue rather than stalling the wait_sig loop. Clear the flag when __SIGNOHOLD is specified.
Diffstat (limited to 'winsup/cygwin/sigproc.cc')
-rw-r--r--winsup/cygwin/sigproc.cc81
1 files changed, 30 insertions, 51 deletions
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index 9deb926de..cf9053804 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -44,8 +44,6 @@ char NO_COPY myself_nowait_dummy[1] = {'0'};// Flag to sig_send that signal goes
#define Static static NO_COPY
-Static HANDLE sig_hold; // Used to stop signal processing
-Static bool sigheld; // True if holding signals
Static int nprocs; // Number of deceased children
Static char cprocs[(NPROCS + 1) * sizeof (pinfo)];// All my children info
@@ -478,24 +476,6 @@ exit_thread (DWORD res)
int __reg3
sig_send (_pinfo *p, int sig, _cygtls *tid)
{
- if (sig == __SIGHOLD)
- sigheld = true;
- else if (!sigheld)
- /* nothing */;
- else if (sig == __SIGFLUSH || sig == __SIGFLUSHFAST)
- return 0;
- else if (sig == __SIGNOHOLD)
- {
- SetEvent (sig_hold);
- sigheld = false;
- }
- else if (&_my_tls == _main_tls)
- {
-#ifdef DEBUGGING
- system_printf ("signal %d sent to %p while signals are on hold", sig, p);
-#endif
- return -1;
- }
siginfo_t si = {};
si.si_signo = sig;
si.si_code = SI_KERNEL;
@@ -1226,7 +1206,7 @@ static void WINAPI
wait_sig (VOID *)
{
_sig_tls = &_my_tls;
- sig_hold = CreateEvent (&sec_none_nih, FALSE, FALSE, NULL);
+ bool sig_held = false;
sigproc_printf ("entering ReadFile loop, my_readsig %p, my_sendsig %p",
my_readsig, my_sendsig);
@@ -1275,33 +1255,7 @@ wait_sig (VOID *)
*pack.mask |= bit;
break;
case __SIGHOLD:
- goto loop;
- break;
- default:
- if (pack.si.si_signo < 0)
- sig_clear (-pack.si.si_signo);
- else
- sigq.add (pack);
- case __SIGNOHOLD:
- case __SIGFLUSH:
- case __SIGFLUSHFAST:
- {
- sigpacket *qnext;
- /* Check the queue for signals. There will always be at least one
- thing on the queue if this was a valid signal. */
- while ((qnext = q->next))
- {
- if (qnext->si.si_signo && qnext->process () <= 0)
- q = q->next;
- else
- {
- q->next = qnext->next;
- qnext->si.si_signo = 0;
- }
- }
- if (pack.si.si_signo == SIGCHLD)
- clearwait = true;
- }
+ sig_held = true;
break;
case __SIGSETPGRP:
init_console_handler (true);
@@ -1328,16 +1282,41 @@ wait_sig (VOID *)
}
}
break;
+ default:
+ if (pack.si.si_signo < 0)
+ sig_clear (-pack.si.si_signo);
+ else
+ sigq.add (pack);
+ case __SIGNOHOLD:
+ sig_held = false;
+ case __SIGFLUSH:
+ case __SIGFLUSHFAST:
+ if (!sig_held)
+ {
+ sigpacket *qnext;
+ /* Check the queue for signals. There will always be at least one
+ thing on the queue if this was a valid signal. */
+ while ((qnext = q->next))
+ {
+ if (qnext->si.si_signo && qnext->process () <= 0)
+ q = q->next;
+ else
+ {
+ q->next = qnext->next;
+ qnext->si.si_signo = 0;
+ }
+ }
+ if (pack.si.si_signo == SIGCHLD)
+ clearwait = true;
+ }
+ break;
}
if (clearwait && !have_execed)
proc_subproc (PROC_CLEARWAIT, 0);
- loop:
if (pack.wakeup)
{
sigproc_printf ("signalling pack.wakeup %p", pack.wakeup);
SetEvent (pack.wakeup);
}
- if (pack.si.si_signo == __SIGHOLD)
- WaitForSingleObject (sig_hold, INFINITE);
}
}