From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9266 invoked by alias); 22 Apr 2005 15:14:50 -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 9104 invoked from network); 22 Apr 2005 15:14:28 -0000 Received: from unknown (205.217.158.180) by sourceware.org with QMTP; 22 Apr 2005 15:14:28 -0000 Received: (qmail 16409 invoked by uid 10); 22 Apr 2005 15:14:27 -0000 Received: (qmail 4697 invoked by uid 500); 22 Apr 2005 15:14:18 -0000 To: Christopher Faylor Cc: gdb-patches@sources.redhat.com, Eli Zaretskii Subject: Re: PATCH: Support Windows in event-loop.c 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> <20050422145958.GH16791@trixie.casa.cgf.cx> From: Ian Lance Taylor Date: Fri, 22 Apr 2005 15:14:00 -0000 In-Reply-To: <20050422145958.GH16791@trixie.casa.cgf.cx> 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/msg00281.txt.bz2 Christopher Faylor writes: > >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. For what it's worth, Tcl implements an event loop on Windows which works for all types of objects. The main trick is to create a little thread which sits around reading the pipe, and raises an event when it gets something. Of course, you then have to carefully hand that data over to the main thread when the main thread wants to read from the pipe. Ian