* cygheap.cc (init_cygheap::find_tls): Don't consider unitialized threads.

* cygtls.cc (_cygtls::operator HANDLE): Return NULL when tid is not set.
* exceptions.cc (setup_handler): Don't try to suspend a thread if it has no
handle.
This commit is contained in:
Christopher Faylor
2012-08-16 17:11:41 +00:00
parent 4e754267ed
commit d01efdbe6e
4 changed files with 40 additions and 25 deletions

View File

@@ -628,14 +628,16 @@ init_cygheap::find_tls (int sig)
{
threadlist_ix = -1;
while (++threadlist_ix < (int) nthreads)
if (sigismember (&(threadlist[threadlist_ix]->sigwait_mask), sig))
if (threadlist[threadlist_ix]->tid
&& sigismember (&(threadlist[threadlist_ix]->sigwait_mask), sig))
{
t = cygheap->threadlist[threadlist_ix];
goto out;
}
threadlist_ix = -1;
while (++threadlist_ix < (int) nthreads)
if (!sigismember (&(threadlist[threadlist_ix]->sigmask), sig))
if (threadlist[threadlist_ix]->tid
&& !sigismember (&(threadlist[threadlist_ix]->sigmask), sig))
{
t = cygheap->threadlist[threadlist_ix];
break;