summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/cygtls.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/cygtls.cc')
-rw-r--r--winsup/cygwin/cygtls.cc27
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