From 6f7a746cee857aae89386d6d337821a49cca81aa Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Tue, 7 Sep 2004 04:05:14 +0000 Subject: [PATCH] * cygtls.cc (_cygtls::init_thread): Set __sdidinit to negative value to indicate that it is "special". * thread.cc (pthread::exit): If __sdidinit is < 0, it was never really initialized so reset it to 0 before calling _reclaim_reent. --- winsup/cygwin/ChangeLog | 7 +++++++ winsup/cygwin/cygtls.cc | 2 +- winsup/cygwin/thread.cc | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 0153cd8f4..0dbabc812 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,10 @@ +2004-09-07 Christopher Faylor + + * cygtls.cc (_cygtls::init_thread): Set __sdidinit to negative value to + indicate that it is "special". + * thread.cc (pthread::exit): If __sdidinit is < 0, it was never really + initialized so reset it to 0 before calling _reclaim_reent. + 2004-09-05 Christopher Faylor * include/cygwin/version.h: Bump DLL minor number to 12. diff --git a/winsup/cygwin/cygtls.cc b/winsup/cygwin/cygtls.cc index d2db5eb2e..a409fda04 100644 --- a/winsup/cygwin/cygtls.cc +++ b/winsup/cygwin/cygtls.cc @@ -107,7 +107,7 @@ _cygtls::init_thread (void *x, DWORD (*func) (void *, void *)) local_clib._stdin = _GLOBAL_REENT->_stdin; local_clib._stdout = _GLOBAL_REENT->_stdout; local_clib._stderr = _GLOBAL_REENT->_stderr; - local_clib.__sdidinit = _GLOBAL_REENT->__sdidinit; + local_clib.__sdidinit = _GLOBAL_REENT->__sdidinit ? -1 : 0; local_clib.__cleanup = _GLOBAL_REENT->__cleanup; local_clib.__sglue._niobs = 3; local_clib.__sglue._iobs = &_GLOBAL_REENT->__sf[0]; diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc index 7ba7399b6..b6c2e94d5 100644 --- a/winsup/cygwin/thread.cc +++ b/winsup/cygwin/thread.cc @@ -355,6 +355,8 @@ pthread::exit (void *value_ptr) mutex.unlock (); } + if (_my_tls.local_clib.__sdidinit < 0) + _my_tls.local_clib.__sdidinit = 0; (_reclaim_reent) (_REENT);