* select.cc (peek_pipe): Only grab mutex when we actually got something from

the pipe.
This commit is contained in:
Christopher Faylor 2001-09-24 22:49:12 +00:00
parent 35f879a6d0
commit 3263838430
4 changed files with 19 additions and 9 deletions

View File

@ -1,3 +1,8 @@
Mon Sep 24 18:46:39 2001 Christopher Faylor <cgf@cygnus.com>
* select.cc (peek_pipe): Only grab mutex when we actually got something
from the pipe.
Mon Sep 24 17:41:03 2001 Christopher Faylor <cgf@redhat.com>
* fhandler.h (fhandler_pipe::hit_eof): New method.

View File

@ -179,9 +179,6 @@ maintainer-clean realclean: clean
# Rule to build libcygwin.a
$(LIB_NAME): new-$(DLL_NAME) $(LIBCOS)
$(AR) rcv $(LIB_NAME) $(LIBCOS)
# Rule to make stub library used by testsuite
# dependency set to $(LIB_NAME) to accomodate make -j2.
@ -199,6 +196,9 @@ new-$(DLL_NAME): $(LDSCRIPT) $(DLL_OFILES) $(DEF_FILE) $(DLL_IMPORTS) $(LIBC) $(
$(DLL_IMPORTS) $(MALLOC_OBJ) $(LIBM) $(LIBC) \
-lstdc++ -lgcc -lshell32 -luuid
$(LIB_NAME): new-$(DLL_NAME) $(LIBCOS)
$(AR) rcv $(LIB_NAME) $(LIBCOS)
dll_ofiles: $(DLL_OFILES)
$(LIBGMON_A): $(GMON_OFILES) $(GMON_START)

View File

@ -77,7 +77,12 @@ extern char __declspec(dllimport) *__progname;
#define IGNORE_FIRST (*options == '-' || *options == '+')
#define PRINT_ERROR ((opterr) && ((*options != ':') \
|| (IGNORE_FIRST && options[1] != ':')))
#define IS_POSIXLY_CORRECT (getenv("POSIXLY_CORRECT") != NULL)
#if defined(__CYGWIN__) || defined(__MINGW32__)
# define IS_POSIXLY_CORRECT (1)
#else
# define IS_POSIXLY_CORRECT (getenv("POSIXLY_CORRECT") != NULL)
#endif
#define PERMUTE (!IS_POSIXLY_CORRECT && !IGNORE_FIRST)
/* XXX: GNU ignores PC if *options == '-' */
#define IN_ORDER (!IS_POSIXLY_CORRECT && *options == '-')

View File

@ -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)
{