Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/cygheap.cc')
-rw-r--r--winsup/cygwin/cygheap.cc33
1 files changed, 15 insertions, 18 deletions
diff --git a/winsup/cygwin/cygheap.cc b/winsup/cygwin/cygheap.cc
index f0a4e3e96..7ac30122b 100644
--- a/winsup/cygwin/cygheap.cc
+++ b/winsup/cygwin/cygheap.cc
@@ -611,37 +611,34 @@ init_cygheap::remove_tls (_cygtls *t, DWORD wait)
}
}
-_cygtls *
-init_cygheap::find_tls (int sig)
+_cygtls __reg3 *
+init_cygheap::find_tls (int sig, bool& issig_wait)
{
debug_printf ("sig %d\n", sig);
tls_sentry here (INFINITE);
- static int NO_COPY threadlist_ix;
+ static int NO_COPY ix;
- _cygtls *t = _main_tls;
+ _cygtls *t = NULL;
+ issig_wait = false;
myfault efault;
if (efault.faulted ())
- threadlist[threadlist_ix]->remove (INFINITE);
+ threadlist[ix]->remove (INFINITE);
else
{
- threadlist_ix = -1;
- while (++threadlist_ix < (int) nthreads)
- if (threadlist[threadlist_ix]->tid
- && sigismember (&(threadlist[threadlist_ix]->sigwait_mask), sig))
+ ix = -1;
+ while (++ix < (int) nthreads)
+ if (!threadlist[ix]->tid)
+ continue;
+ else if (sigismember (&(threadlist[ix]->sigwait_mask), sig))
{
- t = cygheap->threadlist[threadlist_ix];
+ t = cygheap->threadlist[ix];
+ issig_wait = true;
goto out;
}
- threadlist_ix = -1;
- while (++threadlist_ix < (int) nthreads)
- if (threadlist[threadlist_ix]->tid
- && !sigismember (&(threadlist[threadlist_ix]->sigmask), sig))
- {
- t = cygheap->threadlist[threadlist_ix];
- break;
- }
+ else if (!t && !sigismember (&(threadlist[ix]->sigmask), sig))
+ t = cygheap->threadlist[ix];
}
out:
return t;