diff options
Diffstat (limited to 'winsup/cygwin/sigproc.cc')
-rw-r--r-- | winsup/cygwin/sigproc.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index be89d8685..33fbb3a00 100644 --- a/winsup/cygwin/sigproc.cc +++ b/winsup/cygwin/sigproc.cc @@ -561,6 +561,8 @@ exit_thread (DWORD res) { HANDLE h; +# undef ExitThread + if (!DuplicateHandle (GetCurrentProcess (), GetCurrentThread (), GetCurrentProcess (), &h, 0, FALSE, DUPLICATE_SAME_ACCESS)) @@ -573,11 +575,11 @@ exit_thread (DWORD res) ProtectHandle1 (h, exit_thread); siginfo_t si = {__SIGTHREADEXIT, SI_KERNEL}; si.si_value.sival_ptr = h; + lock_process for_now; /* May block indefinitely if we're exiting. */ /* Tell wait_sig to wait for this thread to exit. It can then release the lock below and close the above-opened handle. */ sig_send (myself_nowait, si, &_my_tls); - lock_process for_now; - ExitThread (0); /* Should never hit this */ + ExitThread (0); /* Should never hit this */ } int __stdcall |