aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/thread.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/thread.cc')
-rw-r--r--winsup/cygwin/thread.cc5
1 files changed, 2 insertions, 3 deletions
diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc
index 9a3c7af..1ba3847 100644
--- a/winsup/cygwin/thread.cc
+++ b/winsup/cygwin/thread.cc
@@ -623,7 +623,7 @@ cancelable_wait (HANDLE object, DWORD timeout, const bool do_cancel,
cancel_n = (DWORD) -1;
else
{
- cancel_n = num++;
+ cancel_n = WAIT_OBJECT_0 + num++;
wait_objects[cancel_n] = thread->cancel_event;
}
@@ -632,14 +632,13 @@ cancelable_wait (HANDLE object, DWORD timeout, const bool do_cancel,
sig_n = (DWORD) -1;
else
{
- sig_n = num++;
+ sig_n = WAIT_OBJECT_0 + num++;
wait_objects[sig_n] = signal_arrived;
}
while (1)
{
res = WaitForMultipleObjects (num, wait_objects, FALSE, timeout);
- res -= WAIT_OBJECT_0;
if (res == cancel_n)
{
if (do_cancel)