diff options
author | Ken Brown <kbrown@cornell.edu> | 2019-06-24 19:28:48 +0300 |
---|---|---|
committer | Ken Brown <kbrown@cornell.edu> | 2019-06-25 22:44:43 +0300 |
commit | 9604a251bdeb3ae4a4c958efc14b4694d7324d11 (patch) | |
tree | 20cebca7872d3445afd57f7dd74f3fdafe63eeca /winsup/cygwin/timerfd.h | |
parent | a90aa583fbe7898a7a2699ee380de7783b6e8ed4 (diff) |
Cygwin: timerfd: avoid a deadlock
Add a function timerfd_tracker::enter_critical_section_cancelable,
which is like enter_critical_section but honors a cancel event. Call
this when a timer expires while the timerfd thread is in its inner
loop. This avoids a deadlock if timerfd_tracker::dtor has entered its
critical section and is trying to cancel the thread. See
https://cygwin.com/ml/cygwin/2019-06/msg00096.html.
Diffstat (limited to 'winsup/cygwin/timerfd.h')
-rw-r--r-- | winsup/cygwin/timerfd.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/winsup/cygwin/timerfd.h b/winsup/cygwin/timerfd.h index 154be0847..80688e79e 100644 --- a/winsup/cygwin/timerfd.h +++ b/winsup/cygwin/timerfd.h @@ -86,6 +86,8 @@ class timerfd_tracker /* cygheap! */ return (WaitForSingleObject (_access_mtx, INFINITE) & ~WAIT_ABANDONED_0) == WAIT_OBJECT_0; } + /* A version that honors a cancel event, for use in thread_func. */ + int enter_critical_section_cancelable (); void leave_critical_section () { ReleaseMutex (_access_mtx); |