* 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

@ -119,14 +119,12 @@ ipc_mutex_init (HANDLE *pmtx, const char *name)
static int
ipc_mutex_lock (HANDLE mtx)
{
HANDLE h[2] = { mtx, signal_arrived };
switch (WaitForMultipleObjects (2, h, FALSE, INFINITE))
switch (cancelable_wait (mtx, NULL, cw_sig_eintr | cw_cancel | cw_cancel_self))
{
case WAIT_OBJECT_0:
case WAIT_ABANDONED_0:
return 0;
case WAIT_OBJECT_0 + 1:
case WAIT_SIGNALED:
set_errno (EINTR);
return 1;
default:
@ -174,11 +172,12 @@ ipc_cond_init (HANDLE *pevt, const char *name, char sr)
static int
ipc_cond_timedwait (HANDLE evt, HANDLE mtx, const struct timespec *abstime)
{
HANDLE w4[4] = { evt, signal_arrived, NULL, NULL };
HANDLE w4[4] = { evt, };
DWORD cnt = 2;
DWORD timer_idx = 0;
int ret = 0;
set_thread_waiting (w4[1]);
if ((w4[cnt] = pthread::get_cancel_event ()) != NULL)
++cnt;
if (abstime)