* cygwait.cc (cancelable_wait): Mimic old cygwait behavior more closely wrt

handling of call_signal_handler.
* cygwait.h (WAIT_CANCELED): Move here and redefine.
(WAIT_SIGNALED): Ditto.
* thread.h (WAIT_CANCELED): Delete.
(WAIT_SIGNALED): Ditto.
This commit is contained in:
Christopher Faylor
2012-06-19 00:31:15 +00:00
parent 88fbcb5afd
commit af5cd14583
20 changed files with 78 additions and 90 deletions

View File

@@ -120,12 +120,9 @@ clock_nanosleep (clockid_t clk_id, int flags, const struct timespec *rqtp,
syscall_printf ("clock_nanosleep (%ld.%09ld)", rqtp->tv_sec, rqtp->tv_nsec);
int rc = cancelable_wait (signal_arrived, &timeout);
if (rc == WAIT_OBJECT_0)
{
_my_tls.call_signal_handler ();
res = EINTR;
}
int rc = cancelable_wait (NULL, &timeout, cw_sig | cw_cancel | cw_cancel_self);
if (rc == WAIT_SIGNALED)
res = EINTR;
/* according to POSIX, rmtp is used only if !abstime */
if (rmtp && !abstime)
@@ -565,21 +562,14 @@ extern "C" int
sigwaitinfo (const sigset_t *set, siginfo_t *info)
{
pthread_testcancel ();
HANDLE h;
h = _my_tls.event = CreateEvent (&sec_none_nih, FALSE, FALSE, NULL);
if (!h)
{
__seterrno ();
return -1;
}
_my_tls.sigwait_mask = *set;
sig_dispatch_pending (true);
int res;
switch (WaitForSingleObject (h, INFINITE))
switch (cancelable_wait (NULL, NULL, cw_sig | cw_cancel | cw_cancel_self))
{
case WAIT_OBJECT_0:
case WAIT_SIGNALED:
if (!sigismember (set, _my_tls.infodata.si_signo))
{
set_errno (EINTR);
@@ -598,8 +588,6 @@ sigwaitinfo (const sigset_t *set, siginfo_t *info)
res = -1;
}
_my_tls.event = NULL;
CloseHandle (h);
sigproc_printf ("returning signal %d", res);
return res;
}