Cygwin: (mostly) drop NT4 and Samba < 3.0 support
[newlib-cygwin.git] / winsup / cygwin / local_includes / cygwait.h
blob6212c334e1b9769a1e0246d9fc912546746cb731
1 /* cygwait.h
3 This file is part of Cygwin.
5 This software is a copyrighted work licensed under the terms of the
6 Cygwin license. Please consult the file "CYGWIN_LICENSE" for
7 details. */
9 #pragma once
11 #define WAIT_CANCELED (WAIT_OBJECT_0 + 2)
12 #define WAIT_SIGNALED (WAIT_OBJECT_0 + 1)
14 enum cw_wait_mask
16 cw_cancel = 0x0001, /* Cancellation point. Return to caller. */
17 cw_cancel_self = 0x0002, /* Cancellation point. Cancel self. */
18 cw_sig = 0x0004, /* Handle signals. */
19 cw_sig_eintr = 0x0008, /* Caller handles signals. */
20 cw_sig_cont = 0x0010, /* Caller handles SIGCONT. */
21 cw_sig_restart = 0x0020 /* Restart even if SA_RESTART isn't set. */
24 extern LARGE_INTEGER cw_nowait_storage;
25 #define cw_nowait (&cw_nowait_storage)
26 #define cw_infinite ((PLARGE_INTEGER) NULL)
28 const unsigned cw_std_mask = cw_cancel | cw_cancel_self | cw_sig;
30 DWORD cygwait (HANDLE, PLARGE_INTEGER timeout,
31 unsigned = cw_std_mask);
33 extern inline DWORD __attribute__ ((always_inline))
34 cygwait (HANDLE h, DWORD howlong, unsigned mask)
36 LARGE_INTEGER li_howlong;
37 PLARGE_INTEGER pli_howlong;
38 if (howlong == INFINITE)
39 pli_howlong = NULL;
40 else
42 li_howlong.QuadPart = -(10000ULL * howlong);
43 pli_howlong = &li_howlong;
45 return cygwait (h, pli_howlong, mask);
48 static inline DWORD __attribute__ ((always_inline))
49 cygwait (HANDLE h, DWORD howlong = INFINITE)
51 return cygwait (h, howlong, cw_cancel | cw_sig);
54 static inline DWORD __attribute__ ((always_inline))
55 cygwait (DWORD howlong)
57 return cygwait (NULL, howlong);