diff options
author | Christopher Faylor <me@cgf.cx> | 2001-09-24 22:49:12 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2001-09-24 22:49:12 +0000 |
commit | 3263838430ad3ccf5db934b37c645a83238ea89a (patch) | |
tree | 518c07c89416143325400e7e42da5adda9071f9b /winsup/cygwin/select.cc | |
parent | 35f879a6d0b6c24045570cf882d1474e1ab0de00 (diff) | |
download | cygnal-3263838430ad3ccf5db934b37c645a83238ea89a.tar.gz cygnal-3263838430ad3ccf5db934b37c645a83238ea89a.tar.bz2 cygnal-3263838430ad3ccf5db934b37c645a83238ea89a.zip |
* select.cc (peek_pipe): Only grab mutex when we actually got something from
the pipe.
Diffstat (limited to 'winsup/cygwin/select.cc')
-rw-r--r-- | winsup/cygwin/select.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc index b01d833ef..6520f4b70 100644 --- a/winsup/cygwin/select.cc +++ b/winsup/cygwin/select.cc @@ -449,17 +449,17 @@ peek_pipe (select_record *s, int ignra, HANDLE guard_mutex = NULL) if (fh->get_device () == FH_PIPEW) /* nothing */; + else if (!PeekNamedPipe (h, NULL, 0, NULL, (DWORD *) &n, NULL)) + { + select_printf ("%s, PeekNamedPipe failed, %E", fh->get_name ()); + n = -1; + } else if (guard_mutex && WaitForSingleObject (guard_mutex, 0) != WAIT_OBJECT_0) { select_printf ("%s, couldn't get mutex %p, %E", fh->get_name (), guard_mutex); n = 0; } - else if (!PeekNamedPipe (h, NULL, 0, NULL, (DWORD *) &n, NULL)) - { - select_printf ("%s, PeekNamedPipe failed, %E", fh->get_name ()); - n = -1; - } if (n < 0) { |