* 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.
This commit is contained in:
Christopher Faylor
2004-03-15 02:47:35 +00:00
parent 6644f5097c
commit 168d7785fc
4 changed files with 38 additions and 24 deletions

View File

@ -471,17 +471,19 @@ out1:
// FIXME: This is inelegant
void
_cygtls::remove_wq ()
_cygtls::remove_wq (DWORD wait)
{
sync_proc_subproc->acquire ();
for (waitq *w = &waitq_head; w->next != NULL; w = w->next)
if (w->next == &wq)
{
ForceCloseHandle1 (wq.thread_ev, wq_ev);
w->next = wq.next;
break;
}
sync_proc_subproc->release ();
if (sync_proc_subproc && sync_proc_subproc->acquire (wait))
{
for (waitq *w = &waitq_head; w->next != NULL; w = w->next)
if (w->next == &wq)
{
ForceCloseHandle1 (wq.thread_ev, wq_ev);
w->next = wq.next;
break;
}
sync_proc_subproc->release ();
}
}
/* Terminate the wait_subproc thread.
@ -536,7 +538,6 @@ proc_terminate (void)
pchildren[i].release ();
}
nchildren = nzombies = 0;
sync_proc_subproc = NULL;
}
sigproc_printf ("leaving");
}