Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2004-05-07 07:27:37 +0400
committerChristopher Faylor <me@cgf.cx>2004-05-07 07:27:37 +0400
commit1940656ab9b257cb9944bd0073103aaeea73573a (patch)
treeaa3ed9251ad2905d335927353ce772b959f60fdd /winsup/cygwin/thread.cc
parent718123fadad1b1e334f8c1a01db7313156ffe4e2 (diff)
Christopher Faylor <cgf@timesys.com>
* path.cc (mount_info::conv_to_posix_path): Add return.
Diffstat (limited to 'winsup/cygwin/thread.cc')
-rw-r--r--winsup/cygwin/thread.cc37
1 files changed, 24 insertions, 13 deletions
diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc
index d56d731c8..7aac92ae0 100644
--- a/winsup/cygwin/thread.cc
+++ b/winsup/cygwin/thread.cc
@@ -604,22 +604,33 @@ pthread::cancelable_wait (HANDLE object, DWORD timeout, const bool do_cancel,
because WaitForMultipleObjects will return the smallest index
if both objects are signaled. */
wait_objects[num++] = object;
- if (is_good_object (&thread) &&
- thread->cancelstate != PTHREAD_CANCEL_DISABLE)
- wait_objects[num++] = thread->cancel_event;
- if (do_sig_wait)
- wait_objects[num++] = signal_arrived;
+ DWORD cancel_n;
+ if (!is_good_object (&thread) ||
+ thread->cancelstate == PTHREAD_CANCEL_DISABLE)
+ cancel_n = (DWORD) -1;
+ else
+ {
+ cancel_n = num++;
+ wait_objects[cancel_n] = thread->cancel_event;
+ }
+
+ DWORD sig_n;
+ if (!do_sig_wait || &_my_tls != _main_tls)
+ sig_n = (DWORD) -1;
+ else
+ {
+ sig_n = num++;
+ wait_objects[sig_n] = signal_arrived;
+ }
res = WaitForMultipleObjects (num, wait_objects, FALSE, timeout);
- if (res == WAIT_CANCELED)
+ if (res == sig_n - WAIT_OBJECT_0)
+ res = WAIT_SIGNALED;
+ else if (res == cancel_n - WAIT_OBJECT_0)
{
- if (num == 3 || !do_sig_wait)
- {
- if (do_cancel)
- pthread::static_cancel_self ();
- }
- else
- res = WAIT_SIGNALED;
+ if (do_cancel)
+ pthread::static_cancel_self ();
+ res = WAIT_CANCELED;
}
return res;
}