* cygthread.cc (cygthread::detach): Prioritize waiting for I/O completion over

waiting for signal delivery.
This commit is contained in:
Christopher Faylor
2003-05-09 17:56:58 +00:00
parent 8bdd7abed5
commit 9508ebc53d
3 changed files with 139 additions and 132 deletions

View File

@ -283,17 +283,17 @@ cygthread::detach (HANDLE sigwait)
else
{
HANDLE w4[2];
w4[0] = signal_arrived;
w4[1] = *this;
w4[0] = *this;
w4[1] = signal_arrived;
res = WaitForSingleObject (sigwait, INFINITE);
if (res != WAIT_OBJECT_0)
system_printf ("WFSO sigwait %p failed, res %u, %E", sigwait, res);
res = WaitForMultipleObjects (2, w4, FALSE, INFINITE);
if (res != WAIT_OBJECT_0)
if (res == WAIT_OBJECT_0)
/* nothing */;
else if (WaitForSingleObject (sigwait, 5) == WAIT_OBJECT_0)
else if (WaitForSingleObject (sigwait, 0) == WAIT_OBJECT_0)
res = WaitForSingleObject (*this, INFINITE);
else
else if ((res = WaitForSingleObject (*this, 0)) != WAIT_OBJECT_0)
{
signalled = true;
terminate_thread ();