From db3e9a97e7d339edd6fa15140b1f23aac32c4033 Mon Sep 17 00:00:00 2001 From: cgf Date: Wed, 20 Oct 2004 04:49:33 +0000 Subject: [PATCH] * 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. --- winsup/cygwin/ChangeLog | 7 +++++++ winsup/cygwin/select.cc | 11 +++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 968d40954f..89ac3e42f0 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 b85e0bd56e..30b19f786f 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; } -- 2.11.0