2012-06-17 22:50:24 +02:00
|
|
|
/* cygwait.h
|
|
|
|
|
2015-02-23 14:56:01 +01:00
|
|
|
Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013,
|
|
|
|
2015 Red Hat, Inc.
|
2012-06-17 22:50:24 +02:00
|
|
|
|
|
|
|
This file is part of Cygwin.
|
|
|
|
|
|
|
|
This software is a copyrighted work licensed under the terms of the
|
|
|
|
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
|
|
|
details. */
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2012-06-19 02:38:02 +02:00
|
|
|
#define WAIT_CANCELED (WAIT_OBJECT_0 + 2)
|
|
|
|
#define WAIT_SIGNALED (WAIT_OBJECT_0 + 1)
|
|
|
|
|
2012-06-17 22:50:24 +02:00
|
|
|
enum cw_wait_mask
|
|
|
|
{
|
2015-02-23 14:56:01 +01:00
|
|
|
cw_cancel = 0x0001, /* Cancellation point. Return to caller. */
|
|
|
|
cw_cancel_self = 0x0002, /* Cancellation point. Cancel self. */
|
|
|
|
cw_sig = 0x0004, /* Handle signals. */
|
|
|
|
cw_sig_eintr = 0x0008, /* Caller handles signals. */
|
|
|
|
cw_sig_cont = 0x0010, /* Caller handles SIGCONT. */
|
|
|
|
cw_sig_restart = 0x0020 /* Restart even if SA_RESTART isn't set. */
|
2012-06-17 22:50:24 +02:00
|
|
|
};
|
|
|
|
|
2012-07-22 00:58:20 +02:00
|
|
|
extern LARGE_INTEGER cw_nowait_storage;
|
|
|
|
#define cw_nowait (&cw_nowait_storage)
|
|
|
|
#define cw_infinite ((PLARGE_INTEGER) NULL)
|
|
|
|
|
2012-06-17 22:50:24 +02:00
|
|
|
const unsigned cw_std_mask = cw_cancel | cw_cancel_self | cw_sig;
|
|
|
|
|
2013-01-21 05:34:52 +01:00
|
|
|
DWORD __reg3 cygwait (HANDLE, PLARGE_INTEGER timeout,
|
|
|
|
unsigned = cw_std_mask);
|
2012-06-17 22:50:24 +02:00
|
|
|
|
2012-06-27 23:42:11 +02:00
|
|
|
extern inline DWORD __attribute__ ((always_inline))
|
2012-08-15 21:07:42 +02:00
|
|
|
cygwait (HANDLE h, DWORD howlong, unsigned mask)
|
2012-06-17 22:50:24 +02:00
|
|
|
{
|
|
|
|
LARGE_INTEGER li_howlong;
|
2012-06-27 23:42:11 +02:00
|
|
|
PLARGE_INTEGER pli_howlong;
|
2012-06-17 22:50:24 +02:00
|
|
|
if (howlong == INFINITE)
|
|
|
|
pli_howlong = NULL;
|
|
|
|
else
|
|
|
|
{
|
2012-06-25 07:00:39 +02:00
|
|
|
li_howlong.QuadPart = -(10000ULL * howlong);
|
2012-06-17 22:50:24 +02:00
|
|
|
pli_howlong = &li_howlong;
|
|
|
|
}
|
2012-08-15 21:07:42 +02:00
|
|
|
return cygwait (h, pli_howlong, mask);
|
2012-06-19 02:52:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline DWORD __attribute__ ((always_inline))
|
|
|
|
cygwait (HANDLE h, DWORD howlong = INFINITE)
|
|
|
|
{
|
2012-08-15 21:07:42 +02:00
|
|
|
return cygwait (h, howlong, cw_cancel | cw_sig);
|
2012-06-17 22:50:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline DWORD __attribute__ ((always_inline))
|
|
|
|
cygwait (DWORD howlong)
|
|
|
|
{
|
2012-07-22 00:58:20 +02:00
|
|
|
return cygwait (NULL, howlong);
|
2012-06-17 22:50:24 +02:00
|
|
|
}
|