diff options
author | Christopher Faylor <me@cgf.cx> | 2012-06-19 04:38:02 +0400 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2012-06-19 04:38:02 +0400 |
commit | 2addde8cb1e794a9818b9417839524dbc05401da (patch) | |
tree | 389e9271ffc3ea88d97116b52fa8e838889ab12f /winsup/cygwin/cygthread.cc | |
parent | af5cd145835d35519af02d0d226f67eb777e4945 (diff) |
Revert errneous checkin.
Check in actual change associated with ChangeLog.
Diffstat (limited to 'winsup/cygwin/cygthread.cc')
-rw-r--r-- | winsup/cygwin/cygthread.cc | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/winsup/cygwin/cygthread.cc b/winsup/cygwin/cygthread.cc index 604521c58..4cbd3b064 100644 --- a/winsup/cygwin/cygthread.cc +++ b/winsup/cygwin/cygthread.cc @@ -373,16 +373,20 @@ cygthread::detach (HANDLE sigwait) LONG prio = GetThreadPriority (hth); ::SetThreadPriority (hth, THREAD_PRIORITY_BELOW_NORMAL); + HANDLE w4[2]; + unsigned n = 2; DWORD howlong = INFINITE; + w4[0] = sigwait; + w4[1] = signal_arrived; /* For a description of the below loop see the end of this file */ for (int i = 0; i < 2; i++) - switch (res = cygwait (sigwait, howlong)) + switch (res = WaitForMultipleObjects (n, w4, FALSE, howlong)) { case WAIT_OBJECT_0: if (n == 1) howlong = 50; break; - case WAIT_SIGNALED: + case WAIT_OBJECT_0 + 1: n = 1; if (i--) howlong = 50; @@ -391,7 +395,20 @@ cygthread::detach (HANDLE sigwait) break; default: if (!exiting) - api_fatal ("WFMO failed waiting for cygthread '%s', %E", __name); + { + system_printf ("WFMO failed waiting for cygthread '%s', %E", __name); + for (unsigned j = 0; j < n; j++) + switch (WaitForSingleObject (w4[j], 0)) + { + case WAIT_OBJECT_0: + case WAIT_TIMEOUT: + break; + default: + system_printf ("%s handle %p is bad", (j ? "signal_arrived" : "semaphore"), w4[j]); + break; + } + api_fatal ("exiting on fatal error"); + } break; } /* WAIT_OBJECT_0 means that the thread successfully read something, |