* 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.
This commit is contained in:
Christopher Faylor
2012-06-19 00:52:59 +00:00
parent 2addde8cb1
commit 978441cc0e
6 changed files with 31 additions and 9 deletions

View File

@@ -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);
}