Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2004-10-11 06:21:31 +0400
committerChristopher Faylor <me@cgf.cx>2004-10-11 06:21:31 +0400
commit1cda132258b09d009064856dab1c36f3b9f19628 (patch)
treea2e4d9a212d2d6cd44aacbd9729df00dc6fe68b8 /winsup/cygwin/cygtls.cc
parent8d712c8c3e7cdf417f60b9b38d87332c436114bd (diff)
* cygtls.h (exitsock): New element.
(exitsock_sin): Ditto. * cygtls.cc (_cygtls::init_thread): Initialize exitsock to invalid handle. (_cygtls::call2): Close exitsock if it is valid. * select.cc (struct socketinf): Remove sin element. (start_thread_socket): Initialize one SOCK_DGRAM socket per thread instead of (apparently) expensive opening and closing of socket with each select call. (socket_cleanup): Send a byte to the exitsock socket as a way to potentially signal a waiting-for-socket thread to exit. * tlsoffsets.h: Regenerate.
Diffstat (limited to 'winsup/cygwin/cygtls.cc')
-rw-r--r--winsup/cygwin/cygtls.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/winsup/cygwin/cygtls.cc b/winsup/cygwin/cygtls.cc
index a409fda04..4dcd5df8f 100644
--- a/winsup/cygwin/cygtls.cc
+++ b/winsup/cygwin/cygtls.cc
@@ -92,6 +92,10 @@ _cygtls::call2 (DWORD (*func) (void *, void *), void *arg, void *buf)
_my_tls.init_thread (buf, func);
DWORD res = func (arg, buf);
_my_tls.remove (INFINITE);
+ // FIXME: Need some sort of atthreadexit function to allow things like
+ // select to control this themselves
+ if (_my_tls.locals.exitsock != INVALID_SOCKET)
+ closesocket (_my_tls.locals.exitsock);
ExitThread (res);
}
@@ -114,6 +118,7 @@ _cygtls::init_thread (void *x, DWORD (*func) (void *, void *))
}
local_clib._current_locale = "C";
locals.process_logmask = LOG_UPTO (LOG_DEBUG);
+ locals.exitsock = INVALID_SOCKET;
}
set_state (false);