summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2012-06-25 16:28:50 +0000
committerChristopher Faylor <me@cgf.cx>2012-06-25 16:28:50 +0000
commit6ec05d23b3f5b107968e0a1aaab376c8f0f5d4e8 (patch)
treec32d0377093740e25e8cb65875e7c1b993850fc6
parentd6953d3f7d4753246e1aa1a36146fa22233af02b (diff)
downloadcygnal-6ec05d23b3f5b107968e0a1aaab376c8f0f5d4e8.tar.gz
cygnal-6ec05d23b3f5b107968e0a1aaab376c8f0f5d4e8.tar.bz2
cygnal-6ec05d23b3f5b107968e0a1aaab376c8f0f5d4e8.zip
* cygwait.cc (cancelable_wait): Make sure that timer is cancelled before
cancelling thread.
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/cygwait.cc11
2 files changed, 10 insertions, 6 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 912d44f7f..f648f9b45 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,10 @@
2012-06-25 Christopher Faylor <me.cygwin2012@cgf.cx>
+ * cygwait.cc (cancelable_wait): Make sure that timer is cancelled
+ before cancelling thread.
+
+2012-06-25 Christopher Faylor <me.cygwin2012@cgf.cx>
+
* cygwait.h (cancelable_wait): Need to force time to negative to
indicate relative time.
diff --git a/winsup/cygwin/cygwait.cc b/winsup/cygwin/cygwait.cc
index 9b22bd01f..f6eb0a3a7 100644
--- a/winsup/cygwin/cygwait.cc
+++ b/winsup/cygwin/cygwait.cc
@@ -72,17 +72,13 @@ cancelable_wait (HANDLE object, PLARGE_INTEGER timeout, unsigned mask)
{
res = WaitForMultipleObjects (num, wait_objects, FALSE, INFINITE);
if (res == cancel_n)
- {
- if (is_cw_cancel_self)
- pthread::static_cancel_self ();
- res = WAIT_CANCELED;
- }
+ res = WAIT_CANCELED;
else if (res == timeout_n)
res = WAIT_TIMEOUT;
else if (res != sig_n)
/* all set */;
else if (is_cw_sig_eintr)
- res = WAIT_SIGNALED;
+ res = WAIT_SIGNALED; /* caller will deal with signals */
else if (_my_tls.call_signal_handler () || &_my_tls != _main_tls)
continue;
break;
@@ -101,5 +97,8 @@ cancelable_wait (HANDLE object, PLARGE_INTEGER timeout, unsigned mask)
NtCancelTimer (_my_tls.locals.cw_timer, NULL);
}
+ if (res == WAIT_CANCELED && is_cw_cancel_self)
+ pthread::static_cancel_self ();
+
return res;
}