diff options
author | Christopher Faylor <me@cgf.cx> | 2004-02-26 05:10:49 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2004-02-26 05:10:49 +0000 |
commit | ca713cfab35fe144b73240ebe2c333c36fd7a214 (patch) | |
tree | fea3c6ad34283801c717108aae1f7ff6729f0b92 /winsup/cygwin/exceptions.cc | |
parent | f9e19c093165d7c75bd9d04204845ed53b8ff0a8 (diff) | |
download | cygnal-ca713cfab35fe144b73240ebe2c333c36fd7a214.tar.gz cygnal-ca713cfab35fe144b73240ebe2c333c36fd7a214.tar.bz2 cygnal-ca713cfab35fe144b73240ebe2c333c36fd7a214.zip |
* 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.
Diffstat (limited to 'winsup/cygwin/exceptions.cc')
-rw-r--r-- | winsup/cygwin/exceptions.cc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index f2aec7731..94163fd52 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -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 |