From a2b6c065460280190fbb23bceb8755eeda729bbe Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Wed, 31 May 2006 02:14:17 +0000 Subject: [PATCH] * cygtls.cc (_cygtls::call2): Don't call ExitThread on the main thread. --- winsup/cygwin/ChangeLog | 4 ++++ winsup/cygwin/cygtls.cc | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 34b4ff39e..dd1ab484d 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,7 @@ +2006-05-30 Christopher Faylor + + * cygtls.cc (_cygtls::call2): Don't call ExitThread on the main thread. + 2006-05-29 Christopher Faylor * winf.h (MAXCYGWINCMDLEN): Set down size to 30000 or suffer fork diff --git a/winsup/cygwin/cygtls.cc b/winsup/cygwin/cygtls.cc index d3a67565b..8dd15ad6e 100644 --- a/winsup/cygwin/cygtls.cc +++ b/winsup/cygwin/cygtls.cc @@ -73,7 +73,10 @@ _cygtls::call2 (DWORD (*func) (void *, void *), void *arg, void *buf) init_thread (buf, func); DWORD res = func (arg, buf); remove (INFINITE); - ExitThread (res); + /* Don't call ExitThread on the main thread since we may have been + dynamically loaded. */ + if (this != _main_tls) + ExitThread (res); } void