diff options
author | John Hood <cgull@glup.org> | 2016-01-28 17:08:39 -0500 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2016-03-20 15:26:31 +0100 |
commit | 6e70fd315a29578f090a98f84e9d8e95ddb156e3 (patch) | |
tree | b8becde819804ad541e667fc46084f23b11de19d /winsup/cygwin/cygwait.h | |
parent | 313fcaf1bc7b59dc8bf965dfe620fa342e653389 (diff) | |
download | cygnal-6e70fd315a29578f090a98f84e9d8e95ddb156e3.tar.gz cygnal-6e70fd315a29578f090a98f84e9d8e95ddb156e3.tar.bz2 cygnal-6e70fd315a29578f090a98f84e9d8e95ddb156e3.zip |
Use high-resolution timebases for select().
* cygwait.h: Add cygwait_us() methods.
* select.h: Change prototype for select_stuff::wait() for larger
microsecond timeouts.
* select.cc (pselect): Convert from old cygwin_select().
Implement microsecond timeouts.
(cygwin_select): Rewrite as a wrapper on pselect().
(select): Implement microsecond timeouts.
(select_stuff::wait): Implement microsecond timeouts with a timer
object.
Diffstat (limited to 'winsup/cygwin/cygwait.h')
-rw-r--r-- | winsup/cygwin/cygwait.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/winsup/cygwin/cygwait.h b/winsup/cygwin/cygwait.h index 1240f5404..3e02cdd66 100644 --- a/winsup/cygwin/cygwait.h +++ b/winsup/cygwin/cygwait.h @@ -59,3 +59,30 @@ cygwait (DWORD howlong) { return cygwait (NULL, howlong); } + +extern inline DWORD __attribute__ ((always_inline)) +cygwait_us (HANDLE h, LONGLONG howlong, unsigned mask) +{ + LARGE_INTEGER li_howlong; + PLARGE_INTEGER pli_howlong; + if (howlong < 0LL) + pli_howlong = NULL; + else + { + li_howlong.QuadPart = -(10LL * howlong); + pli_howlong = &li_howlong; + } + return cygwait (h, pli_howlong, mask); +} + +static inline DWORD __attribute__ ((always_inline)) +cygwait_us (HANDLE h, LONGLONG howlong = -1) +{ + return cygwait_us (h, howlong, cw_cancel | cw_sig); +} + +static inline DWORD __attribute__ ((always_inline)) +cygwait_us (LONGLONG howlong) +{ + return cygwait_us (NULL, howlong); +} |