diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index afb622a61..70700f213 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,12 @@ +2011-12-10 Christopher Faylor + + * select.cc (select_stuff::wait): Very minor formatting fix. + (peek_windows): Report on HWND handle used in queries. + * select.h: Update copyright. + * sigproc.h (cygwait): Eliminate multi-argument variety since more + general implementation may cause odd problems in select. Also force to + always be inline. + 2011-12-10 Christopher Faylor * sigproc.h (cygwait): Delete duplicate va_start and add matching diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc index 261f004b2..77a78c427 100644 --- a/winsup/cygwin/select.cc +++ b/winsup/cygwin/select.cc @@ -366,8 +366,8 @@ select_stuff::wait (fd_set *readfds, fd_set *writefds, fd_set *exceptfds, set_errno (s->saw_error ()); return -1; /* Somebody detected an error */ } - else if ((((wait_ret >= m && s->windows_handle) || s->h == w4[wait_ret])) && - s->verify (s, readfds, writefds, exceptfds)) + else if ((((wait_ret >= m && s->windows_handle) || s->h == w4[wait_ret])) + && s->verify (s, readfds, writefds, exceptfds)) gotone = true; select_printf ("gotone %d", gotone); @@ -1498,11 +1498,11 @@ peek_windows (select_record *me, bool) if (PeekMessageW (&m, (HWND) h, 0, 0, PM_NOREMOVE)) { me->read_ready = true; - select_printf ("window %d(%p) ready", me->fd, me->fh->get_handle ()); + select_printf ("window %d(%p) ready", me->fd, h); return 1; } - select_printf ("window %d(%p) not ready", me->fd, me->fh->get_handle ()); + select_printf ("window %d(%p) not ready", me->fd, h); return me->write_ready; } diff --git a/winsup/cygwin/select.h b/winsup/cygwin/select.h index 2f5434bc8..45081b1fb 100644 --- a/winsup/cygwin/select.h +++ b/winsup/cygwin/select.h @@ -1,7 +1,7 @@ /* select.h Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008, 2009, 2010 Red Hat, Inc. + 2005, 2006, 2007, 2008, 2009, 2010, 2011 Red Hat, Inc. This file is part of Cygwin. diff --git a/winsup/cygwin/sigproc.h b/winsup/cygwin/sigproc.h index b0817360c..72427a4c2 100644 --- a/winsup/cygwin/sigproc.h +++ b/winsup/cygwin/sigproc.h @@ -81,33 +81,23 @@ void __stdcall sigproc_init (); #ifdef __INSIDE_CYGWIN__ void __stdcall sigproc_terminate (enum exit_states); -static inline DWORD -cygwait (DWORD n, DWORD howlong, ...) +static inline DWORD __attribute__ ((always_inline)) +cygwait (HANDLE h, DWORD howlong = INFINITE) { - va_list ap; - HANDLE w4[n + 2]; - - va_start (ap, howlong); - for (unsigned i = 0; i < n; i++) - w4[i] = va_arg (ap, HANDLE); - va_end (ap); - + HANDLE w4[3]; + int n = 0; + if ((w4[n] = h) != NULL) + n++; w4[n++] = signal_arrived; if ((w4[n] = pthread::get_cancel_event ()) != NULL) n++; return WaitForMultipleObjects (n, w4, FALSE, howlong); } -static inline DWORD -cygwait (HANDLE h, DWORD wait = INFINITE) -{ - return cygwait (1, wait, h); -} - -static inline DWORD +static inline DWORD __attribute__ ((always_inline)) cygwait (DWORD wait) { - return cygwait ((DWORD) 0, wait); + return cygwait ((HANDLE) NULL, wait); } #endif bool __stdcall pid_exists (pid_t) __attribute__ ((regparm(1)));