* fhandler_socket.cc (fhandler_socket::connect): Fix formatting.
(fhandler_socket::wait): Handle SA_RESTART when signal arrives.
This commit is contained in:
parent
22ebea31c8
commit
125ff9be63
@ -1,3 +1,8 @@
|
|||||||
|
2006-02-06 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* fhandler_socket.cc (fhandler_socket::connect): Fix formatting.
|
||||||
|
(fhandler_socket::wait): Handle SA_RESTART when signal arrives.
|
||||||
|
|
||||||
2006-02-06 Corinna Vinschen <corinna@vinschen.de>
|
2006-02-06 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* include/cygwin/socket.h (CMSG_FIRSTHDR): Avoid compiler warning.
|
* include/cygwin/socket.h (CMSG_FIRSTHDR): Avoid compiler warning.
|
||||||
|
@ -763,7 +763,7 @@ fhandler_socket::connect (const struct sockaddr *name, int namelen)
|
|||||||
res = ::connect (get_socket (), (struct sockaddr *) &sin, namelen);
|
res = ::connect (get_socket (), (struct sockaddr *) &sin, namelen);
|
||||||
if (res == SOCKET_ERROR
|
if (res == SOCKET_ERROR
|
||||||
&& WSAGetLastError () == WSAEWOULDBLOCK)
|
&& WSAGetLastError () == WSAEWOULDBLOCK)
|
||||||
res = wait (evt, 0, INFINITE);
|
res = wait (evt, 0, INFINITE);
|
||||||
release (evt);
|
release (evt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -983,6 +983,10 @@ fhandler_socket::wait (HANDLE event, int flags, DWORD timeout)
|
|||||||
WSAEVENT ev[2] = { event, signal_arrived };
|
WSAEVENT ev[2] = { event, signal_arrived };
|
||||||
WSANETWORKEVENTS evts;
|
WSANETWORKEVENTS evts;
|
||||||
|
|
||||||
|
/* If WSAWaitForMultipleEvents is interrupted by a signal, and the signal
|
||||||
|
has the SA_RESTART flag set, return to this label and... restart. */
|
||||||
|
sa_restart:
|
||||||
|
|
||||||
switch (WSAWaitForMultipleEvents (2, ev, FALSE, timeout, FALSE))
|
switch (WSAWaitForMultipleEvents (2, ev, FALSE, timeout, FALSE))
|
||||||
{
|
{
|
||||||
case WSA_WAIT_TIMEOUT:
|
case WSA_WAIT_TIMEOUT:
|
||||||
@ -1054,6 +1058,11 @@ fhandler_socket::wait (HANDLE event, int flags, DWORD timeout)
|
|||||||
break;
|
break;
|
||||||
case WSA_WAIT_EVENT_0 + 1:
|
case WSA_WAIT_EVENT_0 + 1:
|
||||||
WSASetLastError (WSAEINTR);
|
WSASetLastError (WSAEINTR);
|
||||||
|
if (_my_tls.call_signal_handler ())
|
||||||
|
{
|
||||||
|
sig_dispatch_pending ();
|
||||||
|
goto sa_restart;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
WSASetLastError (WSAEFAULT);
|
WSASetLastError (WSAEFAULT);
|
||||||
|
Loading…
Reference in New Issue
Block a user