From 5fe74396e949b601e54ddb00fa7e486d1be18013 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Wed, 26 Sep 2001 22:24:09 +0000 Subject: [PATCH] * select.cc (peek_pipe): REALLY only grab mutex when we actually got something from the pipe. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/select.cc | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 708462f73..e14725dc6 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +Wed Sep 26 16:02:35 2001 Christopher Faylor + + * select.cc (peek_pipe): REALLY only grab mutex when we actually got + something from the pipe. + Tue Sep 25 21:25:00 2001 Robert Collins * thread.cc (pthread_cond::BroadCast): Use address with verifyable_object_isvalid(). diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc index bef4e8ac0..2307e297e 100644 --- a/winsup/cygwin/select.cc +++ b/winsup/cygwin/select.cc @@ -454,7 +454,8 @@ peek_pipe (select_record *s, int ignra, HANDLE guard_mutex = NULL) select_printf ("%s, PeekNamedPipe failed, %E", fh->get_name ()); n = -1; } - else if (guard_mutex && WaitForSingleObject (guard_mutex, 0) != WAIT_OBJECT_0) + else if (n && guard_mutex + && WaitForSingleObject (guard_mutex, 0) != WAIT_OBJECT_0) { select_printf ("%s, couldn't get mutex %p, %E", fh->get_name (), guard_mutex);