* Makefile.in (clean): Remove sigfe.s.
(sigfe.s): Ensure that sigfe.s will be regenerated if it does not exist. * dll_init.cc (dll_dllcrt0): Simplify initializing tests. * exceptions.cc (setup_handler): Detect when stub caller is either spinning or has acquired the lock after being suspended to avoid windows problems with suspending a win32 API call. * cygtls.h (_cygtls::spinning): Declare new element. * gendef: Remove unused _siglist_index and _siglist declaration. (_sigfe): Set spinning element when potentially looping, waiting for lock. (_sigbe): Ditto. (_cygtls::lock): Ditto. (_longjmp): Ditto. * tlsoffsets.h: Regenerate. * pinfo.cc (_pinfo::exit): Set final exit state here. Call sigproc_terminate if invoked with 'norecord'. Clear any residual _cygtls stuff. * winsup.h (exit_states): Define ES_FINAL. * spawn.cc (spawn_guts): Don't call proc_terminate specifically when execing. Let _pinfo::exit handle that case. * sigproc.cc (wait_subproc): Always exit loop early when proc_loop_wait. * init.cc (munge_threadfunc): Eliminate unused argument. (dll_entry): Reflect above change in call to munge_threadfunc.
This commit is contained in:
@@ -70,26 +70,6 @@ static pending_signals sigqueue;
|
||||
|
||||
struct sigaction *global_sigs;
|
||||
|
||||
void __stdcall
|
||||
sigalloc ()
|
||||
{
|
||||
cygheap->sigs = global_sigs =
|
||||
(struct sigaction *) ccalloc (HEAP_SIGS, NSIG, sizeof (struct sigaction));
|
||||
}
|
||||
|
||||
void __stdcall
|
||||
signal_fixup_after_exec ()
|
||||
{
|
||||
global_sigs = cygheap->sigs;
|
||||
/* Set up child's signal handlers */
|
||||
for (int i = 0; i < NSIG; i++)
|
||||
{
|
||||
global_sigs[i].sa_mask = 0;
|
||||
if (global_sigs[i].sa_handler != SIG_IGN)
|
||||
global_sigs[i].sa_handler = SIG_DFL;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Global variables
|
||||
*/
|
||||
@@ -101,19 +81,15 @@ char NO_COPY myself_nowait_dummy[1] = {'0'};// Flag to sig_send that signal goes
|
||||
HANDLE NO_COPY signal_arrived; // Event signaled when a signal has
|
||||
// resulted in a user-specified
|
||||
// function call
|
||||
/*
|
||||
* Common variables
|
||||
*/
|
||||
|
||||
|
||||
/* How long to wait for message/signals. Normally this is infinite.
|
||||
* On termination, however, these are set to zero as a flag to exit.
|
||||
*/
|
||||
|
||||
#define Static static NO_COPY
|
||||
|
||||
/* How long to wait for message/signals. Normally this is infinite.
|
||||
On termination, however, these are set to zero as a flag to exit. */
|
||||
|
||||
Static DWORD proc_loop_wait = 1000; // Wait for subprocesses to exit
|
||||
|
||||
Static HANDLE sendsig_tome;
|
||||
HANDLE NO_COPY sigCONT; // Used to "STOP" a process
|
||||
Static cygthread *hwait_sig; // Handle of wait_sig thread
|
||||
Static cygthread *hwait_subproc; // Handle of sig_subproc thread
|
||||
@@ -149,6 +125,26 @@ static DWORD WINAPI wait_sig (VOID *arg);
|
||||
static int __stdcall stopped_or_terminated (waitq *, _pinfo *);
|
||||
static DWORD WINAPI wait_subproc (VOID *);
|
||||
|
||||
void __stdcall
|
||||
sigalloc ()
|
||||
{
|
||||
cygheap->sigs = global_sigs =
|
||||
(struct sigaction *) ccalloc (HEAP_SIGS, NSIG, sizeof (struct sigaction));
|
||||
}
|
||||
|
||||
void __stdcall
|
||||
signal_fixup_after_exec ()
|
||||
{
|
||||
global_sigs = cygheap->sigs;
|
||||
/* Set up child's signal handlers */
|
||||
for (int i = 0; i < NSIG; i++)
|
||||
{
|
||||
global_sigs[i].sa_mask = 0;
|
||||
if (global_sigs[i].sa_handler != SIG_IGN)
|
||||
global_sigs[i].sa_handler = SIG_DFL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Determine if the parent process is alive.
|
||||
*/
|
||||
|
||||
@@ -1215,17 +1211,13 @@ wait_subproc (VOID *)
|
||||
{
|
||||
DWORD rc = WaitForMultipleObjects (nchildren + 1, events, FALSE,
|
||||
proc_loop_wait);
|
||||
if (!proc_loop_wait)
|
||||
break;
|
||||
if (rc == WAIT_TIMEOUT)
|
||||
if (!proc_loop_wait)
|
||||
break; // Exiting
|
||||
else
|
||||
continue;
|
||||
continue;
|
||||
|
||||
if (rc == WAIT_FAILED)
|
||||
{
|
||||
if (!proc_loop_wait)
|
||||
break;
|
||||
|
||||
/* It's ok to get an ERROR_INVALID_HANDLE since another thread may have
|
||||
closed a handle in the children[] array. So, we try looping a couple
|
||||
of times to stabilize. FIXME - this is not foolproof. Probably, this
|
||||
@@ -1274,8 +1266,6 @@ wait_subproc (VOID *)
|
||||
si.si_stime = 0;
|
||||
#endif
|
||||
rc = proc_subproc (PROC_CHILDTERMINATED, rc);
|
||||
if (!proc_loop_wait) // Don't bother if wait_subproc is
|
||||
break; // exiting
|
||||
|
||||
/* Send a SIGCHLD to myself. We do this here, rather than in proc_subproc
|
||||
to avoid the proc_subproc lock since the signal thread will eventually
|
||||
|
Reference in New Issue
Block a user