* 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:
@@ -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);
|
||||
|
Reference in New Issue
Block a user