* exceptions.cc (setup_handler): Signal event for any sigwaitinfo if it exists
to force signal to be handled. Zero event here to prevent races. * signal.cc (sigwaitinfo): Use local handle value for everything since signal thread could zero event element at any time. Detect when awaking due to thread not in mask and set return value and errno accordingly. Don't set signal number to zero unless we've recognized the signal. * sigproc.cc (sigq): Rename from sigqueue throughout. * thread.cc (pthread::join): Handle signals received while waiting for thread to terminate. * cygwin.din: Export sighold, sigqueue. * exceptions.cc (sighold): Define new function. * signal.cc (handle_sigprocmask): Set correct errno for invalid signal. Simplify debugging output. (sigqueue): Define new function. * include/cygwin/signal.h (sighold): Declare new function. (sigqueue): Ditto. * include/cygwin/version.h: Bump API minor version number. * include/limits.h (TIMER_MAX): Define. (_POSIX_TIMER_MAX): Ditto.
This commit is contained in:
@@ -813,6 +813,12 @@ setup_handler (int sig, void *handler, struct sigaction& siga, _cygtls *tls)
|
||||
out:
|
||||
if (locked)
|
||||
tls->unlock ();
|
||||
if (interrupted && tls->event)
|
||||
{
|
||||
HANDLE h = tls->event;
|
||||
tls->event = NULL;
|
||||
SetEvent (h);
|
||||
}
|
||||
sigproc_printf ("signal %d %sdelivered", sig, interrupted ? "" : "not ");
|
||||
return interrupted;
|
||||
}
|
||||
@@ -906,6 +912,24 @@ set_process_mask (sigset_t newmask)
|
||||
set_signal_mask (newmask);
|
||||
}
|
||||
|
||||
extern "C" int
|
||||
sighold (int sig)
|
||||
{
|
||||
/* check that sig is in right range */
|
||||
if (sig < 0 || sig >= NSIG)
|
||||
{
|
||||
set_errno (EINVAL);
|
||||
syscall_printf ("signal %d out of range", sig);
|
||||
return -1;
|
||||
}
|
||||
mask_sync->acquire (INFINITE);
|
||||
sigset_t mask = myself->getsigmask ();
|
||||
sigaddset (&mask, sig);
|
||||
set_signal_mask (mask);
|
||||
mask_sync->release ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Set the signal mask for this process.
|
||||
Note that some signals are unmaskable, as in UNIX. */
|
||||
extern "C" void __stdcall
|
||||
|
Reference in New Issue
Block a user