summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/thread.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/thread.cc')
-rw-r--r--winsup/cygwin/thread.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc
index b4a9b2982..3de53f6fa 100644
--- a/winsup/cygwin/thread.cc
+++ b/winsup/cygwin/thread.cc
@@ -885,6 +885,19 @@ pthread::testcancel ()
}
}
+/* Return cancel event handle if it exists *and* cancel is not disabled.
+ This function is supposed to be used from other functions which are
+ cancelable and need the cancel event in a WFMO call. */
+HANDLE
+pthread::get_cancel_event ()
+{
+ pthread_t thread = pthread::self ();
+
+ return (thread && thread->cancel_event
+ && thread->cancelstate != PTHREAD_CANCEL_DISABLE)
+ ? thread->cancel_event : NULL;
+}
+
void
pthread::static_cancel_self ()
{