* 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.
This commit is contained in:
Christopher Faylor
2004-10-11 02:21:31 +00:00
parent 8d712c8c3e
commit 1cda132258
5 changed files with 137 additions and 127 deletions

View File

@@ -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);