Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2012-06-18 00:50:24 +0400
committerChristopher Faylor <me@cgf.cx>2012-06-18 00:50:24 +0400
commit4ae63783821bd2114246166957d25b2acd26c875 (patch)
tree0b7972e9330fa3a3f863621afd18643e485a151f /winsup/cygwin/cygwait.h
parentd66ef282c2473d7df911e6d7d6ef1fc778777097 (diff)
Add '#include "cygwait.h"' throughout, where appropriate.
* DevNotes: Add entry cgf-000012. * Makefile.in (DLL_OFILES): Add cygwait.o. * sigproc.h: Remove cygwait definitions. * cygwait.h: New file. Define/declare Cygwin waitfor functions. * cygwait.cc: Ditto. * exceptions.cc: Include cygwait.h. (handle_sigsuspend): Accommodate change in cancelable_wait arguments. (sigpacket::process): Display thread tls in debugging output. * fhandler.cc (fhandler_base_overlapped::wait_overlapped): Use symbolic names for signal and cancel return. * fhandler_console.cc (fhandler_console::read): Ditto. (fhandler_dev_dsp::Audio_out::waitforspace): Ditto. fhandler_dev_dsp::Audio_in::waitfordata): Ditto. * fhandler_fifo.cc (fhandler_fifo::wait): Ditto. * fhandler_serial.cc (fhandler_serial::raw_read): Ditto. * fhandler_tty.cc (fhandler_pty_slave::read): Ditto. * select.cc (cygwin_select): Ditto. * wait.cc (wait4): Ditto. * thread.cc (cancelable_wait): Move definition to cygwait.h. (pthread_cond::wait): Accommodate change in cancelable_wait arguments. (pthread_mutex::lock): Ditto. (pthread_spinlock::lock): Ditto. (pthread::join): Ditto. (pthread::thread_init_wrapper): Display tls in debugging output. (semaphore::_timedwait): Ditto. * thread.h (cw_sig_wait): Move to cygwait.h. (cw_cancel_action): Delete. (cancelable_wait): Move declaration to cygwait.h.
Diffstat (limited to 'winsup/cygwin/cygwait.h')
-rw-r--r--winsup/cygwin/cygwait.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/winsup/cygwin/cygwait.h b/winsup/cygwin/cygwait.h
new file mode 100644
index 000000000..c2b7f5801
--- /dev/null
+++ b/winsup/cygwin/cygwait.h
@@ -0,0 +1,47 @@
+/* cygwait.h
+
+ Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
+ 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
+
+enum cw_wait_mask
+{
+ cw_cancel = 0x0001,
+ cw_cancel_self = 0x0002,
+ cw_sig = 0x0004,
+ cw_sig_eintr = 0x0008
+};
+
+const unsigned cw_std_mask = cw_cancel | cw_cancel_self | cw_sig;
+
+DWORD cancelable_wait (HANDLE, PLARGE_INTEGER timeout = NULL,
+ unsigned = cw_std_mask)
+ __attribute__ ((regparm (3)));
+
+static inline DWORD __attribute__ ((always_inline))
+cygwait (HANDLE h, DWORD howlong = INFINITE)
+{
+ PLARGE_INTEGER pli_howlong;
+ LARGE_INTEGER li_howlong;
+ if (howlong == INFINITE)
+ pli_howlong = NULL;
+ else
+ {
+ li_howlong.QuadPart = 10000ULL * howlong;
+ pli_howlong = &li_howlong;
+ }
+ return cancelable_wait (h, pli_howlong, cw_cancel | cw_sig_eintr);
+}
+
+static inline DWORD __attribute__ ((always_inline))
+cygwait (DWORD howlong)
+{
+ return cygwait ((HANDLE) NULL, howlong);
+}