libc/winsup/cygwin/cygwait.h
Christopher Faylor 9d2155089e * cygtls.h (_cygtls::reset_signal_arrived): Actually reset the signal_arrived
event.
(_cygtls::handle_SIGCONT): Declare ew function.
* cygwait.cc (is_cw_sig_handle): Delete.
(is_cw_sig_cont): New convenience define.
(cygwait): Clear signal if is_cw_sig_cont and we got a SIGCONT.
* cygwait.h (cw_wait_mask): Add cw_sig_cont.
* exceptions.cc (sig_handle_tty_stop): Tighten "incyg" region.  Use cw_sig_cont
param for cygwait.  Don't zero signal here outside of lock.
(sigpacket::setup_handler): Don't check for in_forkee since we will now never
get here in that state.
(_cygtls::handle_SIGCONT): Define new function.
(sigpacket::process): Call handle_SIGCONT early to deal with SIGCONT.  Nuke
continue_now handling.  Allow SIGKILL to kill a suspended process.  Delete a
couple of now-unneeded labels.
(_cygtls::call_signal_handler): Reorganize setting of incyg within lock.
* sigproc.cc (pending_signals): Simplify.
(pending_signals::clear): New method.
(_cygtls::remove_wq): Reorganize to always close wq.thread_ev if it exists to
avoid handle leaks.
(sig_clear): Simplify by just calling sigq.clear().
(sig_dispatch_pending): Always call sigq.pending even in signal thread to force
another loop in wait_sig.
(sig_send): Remove a "goto out" just before out: label.
(pending_signals::add): Simplify.
(pending_signals::del): Delete.
(pending_signals::next): Delete.
(wait_sig): Define variable q to be the start of the signal queue.  Just
iterate through sigq queue, deleting processed or zeroed signals.  Only set
clearwait when the current signal is SIGCHLD.
* sigproc.h: Add a comment about an unused enum.
2013-04-09 01:01:19 +00:00

61 lines
1.4 KiB
C

/* cygwait.h
Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
Red Hat, Inc.
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
#define WAIT_CANCELED (WAIT_OBJECT_0 + 2)
#define WAIT_SIGNALED (WAIT_OBJECT_0 + 1)
enum cw_wait_mask
{
cw_cancel = 0x0001,
cw_cancel_self = 0x0002,
cw_sig = 0x0004,
cw_sig_eintr = 0x0008,
cw_sig_cont = 0x0010
};
extern LARGE_INTEGER cw_nowait_storage;
#define cw_nowait (&cw_nowait_storage)
#define cw_infinite ((PLARGE_INTEGER) NULL)
const unsigned cw_std_mask = cw_cancel | cw_cancel_self | cw_sig;
DWORD __reg3 cygwait (HANDLE, PLARGE_INTEGER timeout,
unsigned = cw_std_mask);
extern inline DWORD __attribute__ ((always_inline))
cygwait (HANDLE h, DWORD howlong, unsigned mask)
{
LARGE_INTEGER li_howlong;
PLARGE_INTEGER pli_howlong;
if (howlong == INFINITE)
pli_howlong = NULL;
else
{
li_howlong.QuadPart = -(10000ULL * howlong);
pli_howlong = &li_howlong;
}
return cygwait (h, pli_howlong, mask);
}
static inline DWORD __attribute__ ((always_inline))
cygwait (HANDLE h, DWORD howlong = INFINITE)
{
return cygwait (h, howlong, cw_cancel | cw_sig);
}
static inline DWORD __attribute__ ((always_inline))
cygwait (DWORD howlong)
{
return cygwait (NULL, howlong);
}