diff options
author | Christopher Faylor <me@cgf.cx> | 2004-03-15 02:47:35 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2004-03-15 02:47:35 +0000 |
commit | 168d7785fc2c13bca530c20b2015042903484b48 (patch) | |
tree | eb6a14a747fbb5468409133b4f34b4162ea645c1 /winsup/cygwin/cygtls.cc | |
parent | 6644f5097cdadf7e1747a7d23418e4ba8d03e350 (diff) | |
download | cygnal-168d7785fc2c13bca530c20b2015042903484b48.tar.gz cygnal-168d7785fc2c13bca530c20b2015042903484b48.tar.bz2 cygnal-168d7785fc2c13bca530c20b2015042903484b48.zip |
* cygtls.cc (_cygtls::remove): Call remove_wq even when we can't necessarily
get the cygtls table lock.
* cygtls.h (_cygtls::remove_wq): Add wait argument.
* sigproc.cc (_cygtls::remove_wq): Honor wait argument when acquiring lock.
(proc_terminate): Don't NULL sync_proc_subproc since other threads may still
try to access it.
Diffstat (limited to 'winsup/cygwin/cygtls.cc')
-rw-r--r-- | winsup/cygwin/cygtls.cc | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/winsup/cygwin/cygtls.cc b/winsup/cygwin/cygtls.cc index f9770bbb0..f6f470634 100644 --- a/winsup/cygwin/cygtls.cc +++ b/winsup/cygwin/cygtls.cc @@ -150,19 +150,22 @@ void _cygtls::remove (DWORD wait) { debug_printf ("wait %p\n", wait); - sentry here (wait); - if (here.acquired ()) + do { - for (size_t i = 0; i < nthreads; i++) - if (this == cygheap->threadlist[i]) - { - if (i < --nthreads) - cygheap->threadlist[i] = cygheap->threadlist[nthreads]; - debug_printf ("removed %p element %d", this, i); - remove_wq (); - break; - } - } + sentry here (wait); + if (here.acquired ()) + { + for (size_t i = 0; i < nthreads; i++) + if (this == cygheap->threadlist[i]) + { + if (i < --nthreads) + cygheap->threadlist[i] = cygheap->threadlist[nthreads]; + debug_printf ("removed %p element %d", this, i); + break; + } + } + } while (0); + remove_wq (wait); } void |