diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2006-02-06 20:50:23 +0300 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2006-02-06 20:50:23 +0300 |
commit | 125ff9be63714e51d9668a100193d1e63e645281 (patch) | |
tree | ba4f6910f4e4c64a77f7f81fe90cbce2c2932552 /winsup | |
parent | 22ebea31c8586a57cf7ed3869a9715b359449833 (diff) |
* fhandler_socket.cc (fhandler_socket::connect): Fix formatting.
(fhandler_socket::wait): Handle SA_RESTART when signal arrives.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 5 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_socket.cc | 11 |
2 files changed, 15 insertions, 1 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index dad2d45da..9126ddf2b 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,5 +1,10 @@ 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> + * include/cygwin/socket.h (CMSG_FIRSTHDR): Avoid compiler warning. 2006-02-05 Corinna Vinschen <corinna@vinschen.de> diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index 59c61c81d..7d666620f 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -763,7 +763,7 @@ fhandler_socket::connect (const struct sockaddr *name, int namelen) res = ::connect (get_socket (), (struct sockaddr *) &sin, namelen); if (res == SOCKET_ERROR && WSAGetLastError () == WSAEWOULDBLOCK) - res = wait (evt, 0, INFINITE); + res = wait (evt, 0, INFINITE); release (evt); } } @@ -983,6 +983,10 @@ fhandler_socket::wait (HANDLE event, int flags, DWORD timeout) WSAEVENT ev[2] = { event, signal_arrived }; 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)) { case WSA_WAIT_TIMEOUT: @@ -1054,6 +1058,11 @@ fhandler_socket::wait (HANDLE event, int flags, DWORD timeout) break; case WSA_WAIT_EVENT_0 + 1: WSASetLastError (WSAEINTR); + if (_my_tls.call_signal_handler ()) + { + sig_dispatch_pending (); + goto sa_restart; + } break; default: WSASetLastError (WSAEFAULT); |