From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20423 invoked by alias); 22 Apr 2005 15:04:07 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 16065 invoked from network); 22 Apr 2005 15:00:05 -0000 Received: from unknown (HELO cgf.cx) (66.30.17.189) by sourceware.org with SMTP; 22 Apr 2005 15:00:05 -0000 Received: by cgf.cx (Postfix, from userid 201) id 68EC513C9AC; Fri, 22 Apr 2005 10:59:58 -0400 (EDT) Date: Fri, 22 Apr 2005 15:04:00 -0000 From: Christopher Faylor To: gdb-patches@sources.redhat.com, Eli Zaretskii Subject: Re: PATCH: Support Windows in event-loop.c Message-ID: <20050422145958.GH16791@trixie.casa.cgf.cx> Mail-Followup-To: gdb-patches@sources.redhat.com, Eli Zaretskii References: <200504210549.j3L5n2nP027728@sirius.codesourcery.com> <01c546a1$Blat.v2.4$e03250c0@zahav.net.il> <4267F742.2090108@codesourcery.com> <01c546b0$Blat.v2.4$c193bb40@zahav.net.il> <20050421205617.GA13146@nevyn.them.org> <426817F0.5070404@codesourcery.com> <01c54714$Blat.v2.4$a1df2140@zahav.net.il> <20050422120803.GD16791@trixie.casa.cgf.cx> <01c5473e$Blat.v2.4$39651f00@zahav.net.il> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <01c5473e$Blat.v2.4$39651f00@zahav.net.il> User-Agent: Mutt/1.5.8i X-SW-Source: 2005-04/txt/msg00280.txt.bz2 On Fri, Apr 22, 2005 at 04:20:40PM +0300, Eli Zaretskii wrote: >> Date: Fri, 22 Apr 2005 08:08:04 -0400 >> From: Christopher Faylor >> >> Well, again, I have a rather major technical concern about the use of >> WaitForMultipleObjects in this scenario, so as the Windows maintainer, >> I'd like to see that addressed. You can't reliably just use >> WaitForMultiple on, say, a serial port, a socket, or a pipe, so I don't >> know how this would ever work. > >I'm not sure I understand what you are saying, Chris. Are you saying >that there's no known way of emulating the Posix `select' on Windows >in a way that would work on serial ports and pipes? (I assume sockets >are a non-issue, since the Windows implementation of `select' supports >them.) I'm saying that you can't just use WaitForMultipleObjects as a replacement for select. You have to go to more effort than that, unfortunately. AFAIK, the only file-like device that can be used in WaitForMultipleObjects is the windows console. >Or are you saying that WaitForMultipleObjects is not the way to write >such an emulation? If so, what system calls are better candidates? > >FWIW, the Emacs emulation of `select' does work on pipes, so it seems >that at least in that case there's code to borrow. Cygwin's emulation does too, but it doesn't use WaitForMultipleObjects. AFAIK, the only way to do non-blocking reads on normal pipes is to poll the pipe with the PeekNamedPipe call. It's ugly and painful. The Windows API is full of interesting and useful stuff mixed together with inexplicably annoying and limited stuff. >If we cannot make a `select' emulation that works for some of these >devices, we could simply document them as a limitation. That doesn't >make the Windows build worse than it is now, does it? Cygwin has a fully functional select (at least for the read side of things) so it is possible to come close. FWIW, you can do non-blocking I/O on serial handles by opening them in "overlapped" mode but I don't know if there's any way to do that via the UNIX-lite "fopen/open" MSVCRT interface. cgf