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
11 #define WAIT_CANCELED (WAIT_OBJECT_0 + 2)
12 #define WAIT_SIGNALED (WAIT_OBJECT_0 + 1)
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
)
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
);