diff options
author | Christopher Faylor <me@cgf.cx> | 2012-06-19 04:52:59 +0400 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2012-06-19 04:52:59 +0400 |
commit | 978441cc0ea58a2f3fd5d84f1d0f50bc8307b34a (patch) | |
tree | 3afb58a7fcc101fd407582a1c38b020526797e1e /winsup/cygwin/cygwait.h | |
parent | 2addde8cb1e794a9818b9417839524dbc05401da (diff) |
* cygwait.h (LARGE_NULL): Define.
(cancelable_wait): Define variant which accepts DWORD time argument.
(cygwait): Use cancelable_wait with DWORD argument.
(cygwait): Use cancelable_wait with DWORD argument and cw_sig_eintr for
timeout-only case.
* exceptions.cc (handle_sigsuspend): Use LARGE_NULL as second argument to
distinguish between cancelable_wait variants.
* thread.cc (pthread_mutex::lock): Ditto.
(pthread::join): Ditto.
(semaphore::_timedwait): Ditto.
* thread.h (fast_mutex::lock): Ditto.
* wait.cc (wait4): Ditto.
Diffstat (limited to 'winsup/cygwin/cygwait.h')
-rw-r--r-- | winsup/cygwin/cygwait.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/winsup/cygwin/cygwait.h b/winsup/cygwin/cygwait.h index 9b2be02ac..9a49be7ff 100644 --- a/winsup/cygwin/cygwait.h +++ b/winsup/cygwin/cygwait.h @@ -22,6 +22,7 @@ enum cw_wait_mask cw_sig_eintr = 0x0008 }; +#define LARGE_NULL ((PLARGE_INTEGER) NULL) const unsigned cw_std_mask = cw_cancel | cw_cancel_self | cw_sig; DWORD cancelable_wait (HANDLE, PLARGE_INTEGER timeout = NULL, @@ -29,7 +30,7 @@ DWORD cancelable_wait (HANDLE, PLARGE_INTEGER timeout = NULL, __attribute__ ((regparm (3))); static inline DWORD __attribute__ ((always_inline)) -cygwait (HANDLE h, DWORD howlong = INFINITE) +cancelable_wait (HANDLE h, DWORD howlong, unsigned mask) { PLARGE_INTEGER pli_howlong; LARGE_INTEGER li_howlong; @@ -40,11 +41,17 @@ cygwait (HANDLE h, DWORD howlong = INFINITE) li_howlong.QuadPart = 10000ULL * howlong; pli_howlong = &li_howlong; } - return cancelable_wait (h, pli_howlong, cw_cancel | cw_sig); + return cancelable_wait (h, pli_howlong, mask); +} + +static inline DWORD __attribute__ ((always_inline)) +cygwait (HANDLE h, DWORD howlong = INFINITE) +{ + return cancelable_wait (h, howlong, cw_cancel | cw_sig); } static inline DWORD __attribute__ ((always_inline)) cygwait (DWORD howlong) { - return cygwait ((HANDLE) NULL, howlong); + return cancelable_wait (NULL, howlong, cw_cancel | cw_sig_eintr); } |