* 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

@ -130,7 +130,7 @@ get_inet_addr (const struct sockaddr *in, int inlen,
pthread_testcancel ();
/* Using IsEventSignalled like this is racy since another thread could
be waiting for signal_arrived. */
if (IsEventSignalled (signal_arrived)
if (cancelable_wait (NULL, cw_nowait, cw_sig_eintr) == WAIT_SIGNALED
&& !_my_tls.call_signal_handler ())
{
set_errno (EINTR);
@ -662,7 +662,8 @@ fhandler_socket::wait_for_events (const long event_mask, const DWORD flags)
return SOCKET_ERROR;
}
WSAEVENT ev[2] = { wsock_evt, signal_arrived };
WSAEVENT ev[2] = { wsock_evt };
set_thread_waiting (ev[1]);
switch (WSAWaitForMultipleEvents (2, ev, FALSE, 50, FALSE))
{
case WSA_WAIT_TIMEOUT:
@ -1784,7 +1785,7 @@ fhandler_socket::close ()
res = -1;
break;
}
if (WaitForSingleObject (signal_arrived, 10) == WAIT_OBJECT_0)
if (cygwait (10) == WAIT_SIGNALED)
{
set_errno (EINTR);
res = -1;