4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-02-28 03:27:46 +08:00

* 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

@ -1,3 +1,12 @@
2012-08-16 Christopher Faylor <me.cygwin2012@cgf.cx>
* 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.
2012-08-15 Christopher Faylor <me.cygwin2012@cgf.cx>
Rename cancelable_wait -> cygwait throughout.

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;

View File

@ -226,7 +226,7 @@ public:
void signal_debugger (int) __attribute__ ((regparm(2)));
#ifdef CYGTLS_HANDLE
operator HANDLE () const {return tid->win32_obj_id;}
operator HANDLE () const {return tid ? NULL : tid->win32_obj_id;}
#endif
void set_siginfo (struct sigpacket *) __attribute__ ((regparm (3)));
int call_signal_handler () __attribute__ ((regparm (1)));

View File

@ -846,7 +846,10 @@ setup_handler (int sig, void *handler, struct sigaction& siga, _cygtls *tls)
DWORD res;
HANDLE hth = (HANDLE) *tls;
if (!hth)
sigproc_printf ("thread handle NULL, not set up yet?");
else
{
/* Suspend the thread which will receive the signal.
If one of these conditions is not true we loop.
If the thread is already suspended (which can occur when a program
@ -870,6 +873,7 @@ setup_handler (int sig, void *handler, struct sigaction& siga, _cygtls *tls)
ResumeThread (hth);
if (interrupted)
goto out;
}
sigproc_printf ("couldn't interrupt. trying again.");
yield ();