* cygwait.cc (cancelable_wait): Make sure that timer is cancelled before

cancelling thread.
This commit is contained in:
Christopher Faylor 2012-06-25 16:28:50 +00:00
parent d6953d3f7d
commit 6ec05d23b3
2 changed files with 10 additions and 6 deletions

View File

@ -1,3 +1,8 @@
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> 2012-06-25 Christopher Faylor <me.cygwin2012@cgf.cx>
* cygwait.h (cancelable_wait): Need to force time to negative to * cygwait.h (cancelable_wait): Need to force time to negative to

View File

@ -72,17 +72,13 @@ cancelable_wait (HANDLE object, PLARGE_INTEGER timeout, unsigned mask)
{ {
res = WaitForMultipleObjects (num, wait_objects, FALSE, INFINITE); res = WaitForMultipleObjects (num, wait_objects, FALSE, INFINITE);
if (res == cancel_n) if (res == cancel_n)
{ res = WAIT_CANCELED;
if (is_cw_cancel_self)
pthread::static_cancel_self ();
res = WAIT_CANCELED;
}
else if (res == timeout_n) else if (res == timeout_n)
res = WAIT_TIMEOUT; res = WAIT_TIMEOUT;
else if (res != sig_n) else if (res != sig_n)
/* all set */; /* all set */;
else if (is_cw_sig_eintr) 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) else if (_my_tls.call_signal_handler () || &_my_tls != _main_tls)
continue; continue;
break; break;
@ -101,5 +97,8 @@ cancelable_wait (HANDLE object, PLARGE_INTEGER timeout, unsigned mask)
NtCancelTimer (_my_tls.locals.cw_timer, NULL); NtCancelTimer (_my_tls.locals.cw_timer, NULL);
} }
if (res == WAIT_CANCELED && is_cw_cancel_self)
pthread::static_cancel_self ();
return res; return res;
} }