diff options
author | Christopher Faylor <me@cgf.cx> | 2004-10-11 02:21:31 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2004-10-11 02:21:31 +0000 |
commit | 1cda132258b09d009064856dab1c36f3b9f19628 (patch) | |
tree | a2e4d9a212d2d6cd44aacbd9729df00dc6fe68b8 /winsup/cygwin/cygtls.cc | |
parent | 8d712c8c3e7cdf417f60b9b38d87332c436114bd (diff) | |
download | cygnal-1cda132258b09d009064856dab1c36f3b9f19628.tar.gz cygnal-1cda132258b09d009064856dab1c36f3b9f19628.tar.bz2 cygnal-1cda132258b09d009064856dab1c36f3b9f19628.zip |
* 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.cc | 5 |
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); |