diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2014-11-28 23:46:13 +0300 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2014-11-28 23:46:13 +0300 |
commit | 26158dc3e9c20fc0488944f0c3eefdc19255e7da (patch) | |
tree | 93f7cb9eab294721a54e3892e5e81be7791c0544 /winsup/cygwin/cygtls.cc | |
parent | c2f50c4099b5b3db7dca5797bde8c5886d999c36 (diff) |
* cygheap.cc (init_cygheap::init_tls_list): Accommodate threadlist
having a new type threadlist_t *. Convert commented out code into an
#if 0. Create thread mutex. Explain why.
(init_cygheap::remove_tls): Drop timeout value. Always wait infinitely
for tls_sentry. Return mutex HANDLE of just deleted threadlist entry.
(init_cygheap::find_tls): New implementation taking tls pointer as
search parameter. Return threadlist_t *.
(init_cygheap::find_tls): Return threadlist_t *. Define ix as auto
variable. Drop exception handling since crash must be made impossible
due to correct synchronization. Return with locked mutex.
* cygheap.h (struct threadlist_t): Define.
(struct init_cygheap): Convert threadlist to threadlist_t type.
(init_cygheap::remove_tls): Align declaration to above change.
(init_cygheap::find_tls): Ditto.
(init_cygheap::unlock_tls): Define.
* cygtls.cc (_cygtls::remove): Unlock and close mutex when finishing.
* exceptions.cc (sigpacket::process): Lock _cygtls area of thread before
accessing it.
* fhandler_termios.cc (fhandler_termios::bg_check): Ditto.
* sigproc.cc (sig_send): Ditto.
* thread.cc (pthread::exit): Ditto. Add comment.
(pthread::cancel): Ditto.
Diffstat (limited to 'winsup/cygwin/cygtls.cc')
-rw-r--r-- | winsup/cygwin/cygtls.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/winsup/cygwin/cygtls.cc b/winsup/cygwin/cygtls.cc index 83a62f1ae..84170ca01 100644 --- a/winsup/cygwin/cygtls.cc +++ b/winsup/cygwin/cygtls.cc @@ -180,7 +180,7 @@ _cygtls::remove (DWORD wait) debug_printf ("wait %u", wait); - cygheap->remove_tls (this, INFINITE); + HANDLE mutex = cygheap->remove_tls (this); remove_wq (wait); /* FIXME: Need some sort of atthreadexit function to allow things like @@ -211,6 +211,11 @@ _cygtls::remove (DWORD wait) /* Close timer handle. */ if (locals.cw_timer) NtClose (locals.cw_timer); + if (mutex) + { + ReleaseMutex (mutex); + CloseHandle (mutex); + } } #ifdef __x86_64__ |