From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11942 invoked by alias); 25 Apr 2005 15:50:41 -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 11384 invoked from network); 25 Apr 2005 15:49:49 -0000 Received: from unknown (205.217.158.180) by sourceware.org with QMTP; 25 Apr 2005 15:49:49 -0000 Received: (qmail 18814 invoked by uid 10); 25 Apr 2005 15:49:48 -0000 Received: (qmail 18464 invoked by uid 500); 25 Apr 2005 15:49:37 -0000 To: Mark Mitchell Cc: Daniel Jacobowitz , Christopher Faylor , gdb-patches@sources.redhat.com Subject: Re: PATCH: Support Windows in event-loop.c References: <20050421205617.GA13146@nevyn.them.org> <01c54713$Blat.v2.4$5d0b4ea0@zahav.net.il> <20050424221806.GA13942@nevyn.them.org> <426C3270.4050608@codesourcery.com> <20050425042414.GA7322@trixie.casa.cgf.cx> <20050425131611.GA7821@nevyn.them.org> <20050425145023.GD6543@trixie.casa.cgf.cx> <426D05D6.8010903@codesourcery.com> <20050425150422.GA13753@nevyn.them.org> <426D0A11.4060604@codesourcery.com> <20050425152324.GA15521@nevyn.them.org> <426D0C1D.8040600@codesourcery.com> From: Ian Lance Taylor Date: Mon, 25 Apr 2005 15:50:00 -0000 In-Reply-To: <426D0C1D.8040600@codesourcery.com> Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2005-04/txt/msg00313.txt.bz2 Mark Mitchell writes: > Now, assuming I can do this, do y'all want me to try to put this in > libiberty, or in GDB itself? I suspect that a select which can works on Windows named pipes can only be implemented in conjunction with an I/O library for reading from the pipes. This is because to make select work properly, the thread which is responsible for the pipe has to actually read some data from the pipe. At least the last time I looked, there is no way to wait for a pipe to have some data available. There is a PeekNamedPipe (I think) call which can check whether there is data available, but the only way to use that is to busy wait. So that means that the thread will have read some data which the main program wants. And the only reasonable way I see to handle that is to provide an interface to read from the descriptor which will check whether any data was read by the read. In other words, you need not just a select emulation, but also a read emulation, and the two have to work together. And really to make that work reasonably, you will need to emulate open, close and write also. And that we get into socket and pipe. So that is crazy. We don't want to emulate select. I think it would make more sense to add an argument to add_file_handler which indicates the type of the file descriptor. Then split up event-loop.c into generic code, Unix specific code, and Windows specific code. Ian