diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 968d40954..89ac3e42f 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,10 @@ +2004-10-20 Christopher Faylor + + * select.cc (start_thread_socket): Remove attempt to delay reading of + exitsock or suffer occasional mysterious 60 second hangs. + (socket_cleanup): Empty the exitsock here after the thread has + terminated. + 2004-10-19 Christopher Faylor * fhandler_console.cc (fhandler_console::fixup_after_exec): Fix error diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc index b85e0bd56..30b19f786 100644 --- a/winsup/cygwin/select.cc +++ b/winsup/cygwin/select.cc @@ -1346,12 +1346,7 @@ start_thread_socket (select_record *me, select_stuff *stuff) } if (_my_tls.locals.exitsock != INVALID_SOCKET) - { - char buf[1]; - si->exitsock = _my_tls.locals.exitsock; - select_printf ("read a byte from %p", si->exitsock); - recv (si->exitsock, buf, 1, 0); - } + si->exitsock = _my_tls.locals.exitsock; else { si->exitsock = _my_tls.locals.exitsock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP); @@ -1408,6 +1403,10 @@ socket_cleanup (select_record *, select_stuff *stuff) select_printf ("sent a byte to the exit sock %p, res %d", _my_tls.locals.exitsock, res); /* Wait for thread to go away */ si->thread->detach (); + /* empty the socket */ + select_printf ("reading a byte from %p", si->exitsock); + res = recv (si->exitsock, buf, 1, 0); + select_printf ("recv returned %d", res); stuff->device_specific_socket = NULL; delete si; }