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:
Diffstat (limited to 'winsup/cygwin/sigproc.cc')
-rw-r--r--winsup/cygwin/sigproc.cc25
1 files changed, 20 insertions, 5 deletions
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index d893fc2d8..05d98729f 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -43,10 +43,14 @@ int __sp_ln;
char NO_COPY myself_nowait_dummy[1] = {'0'};// Flag to sig_send that signal goes to
// current process but no wait is required
+HANDLE NO_COPY signal_arrived; // Event signaled when a signal has
+ // resulted in a user-specified
+ // function call
#define Static static NO_COPY
-Static HANDLE sig_hold; // Used to stop signal processing
+HANDLE NO_COPY sigCONT; // Used to "STOP" a process
+
Static bool sigheld; // True if holding signals
Static int nprocs; // Number of deceased children
@@ -514,6 +518,17 @@ sig_dispatch_pending (bool fast)
sig_send (myself, fast ? __SIGFLUSHFAST : __SIGFLUSH);
}
+void __stdcall
+create_signal_arrived ()
+{
+ if (signal_arrived)
+ return;
+ /* local event signaled when main thread has been dispatched
+ to a signal handler function. */
+ signal_arrived = CreateEvent (&sec_none_nih, false, false, NULL);
+ ProtectHandle (signal_arrived);
+}
+
/* Signal thread initialization. Called from dll_crt0_1.
This routine starts the signal handling thread. */
void __stdcall
@@ -567,7 +582,7 @@ sig_send (_pinfo *p, int sig)
return 0;
else if (sig == __SIGNOHOLD || sig == __SIGEXIT)
{
- SetEvent (sig_hold);
+ SetEvent (sigCONT);
sigheld = false;
}
else if (&_my_tls == _main_tls)
@@ -1218,7 +1233,7 @@ stopped_or_terminated (waitq *parent_w, _pinfo *child)
int might_match;
waitq *w = parent_w->next;
- sigproc_printf ("considering pid %d, pgid %d, w->pid %d", child->pid, child->pgid, w->pid);
+ sigproc_printf ("considering pid %d", child->pid);
if (w->pid == -1)
might_match = 1;
else if (w->pid == 0)
@@ -1344,7 +1359,7 @@ static void WINAPI
wait_sig (VOID *)
{
_sig_tls = &_my_tls;
- sig_hold = CreateEvent (&sec_none_nih, FALSE, FALSE, NULL);
+ sigCONT = CreateEvent (&sec_none_nih, FALSE, FALSE, NULL);
sigproc_printf ("entering ReadFile loop, my_readsig %p, my_sendsig %p",
my_readsig, my_sendsig);
@@ -1354,7 +1369,7 @@ wait_sig (VOID *)
for (;;)
{
if (pack.si.si_signo == __SIGHOLD)
- WaitForSingleObject (sig_hold, INFINITE);
+ WaitForSingleObject (sigCONT, INFINITE);
DWORD nb;
pack.tls = NULL;
if (!ReadFile (my_readsig, &pack, sizeof (pack), &nb, NULL))