From 6a712635dd1de131634c5db1cd5b9221a6544ec6 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sun, 14 Jun 2009 05:38:55 +0000 Subject: * fhandler.cc (fhandler_base::wait_overlapped): Honor nonblocking flag for writes. Don't reset event handle when we see a ERROR_IO_PENDING. * sigproc.cc (stopped_or_terminated): Use bool constants for consistency. * wait.cc (wait4): Remove nonsensical comment. --- winsup/cygwin/fhandler.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'winsup/cygwin/fhandler.cc') diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index ec0d6d021..0d499ba9c 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -1684,8 +1684,13 @@ fhandler_base::wait_overlapped (bool inres, bool writing, DWORD *bytes) int res = 0; DWORD err; - if (inres || ((err = GetLastError ()) == ERROR_IO_PENDING)) - { + if (is_nonblocking ()) + { + err = GetLastError (); + res = inres; + } + else if (inres || ((err = GetLastError ()) == ERROR_IO_PENDING)) + { #ifdef DEBUGGING if (!get_overlapped ()) system_printf ("get_overlapped is zero?"); @@ -1745,7 +1750,8 @@ fhandler_base::wait_overlapped (bool inres, bool writing, DWORD *bytes) app. Sigh.). Must do this after WFMO and GetOverlappedResult or suffer occasional sporadic problems: http://cygwin.com/ml/cygwin/2008-08/msg00511.html */ - ResetEvent (get_overlapped ()->hEvent); + if (err != ERROR_IO_PENDING) + ResetEvent (get_overlapped ()->hEvent); if (writing && (err == ERROR_NO_DATA || err == ERROR_BROKEN_PIPE)) raise (SIGPIPE); return res; -- cgit v1.2.3