This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: PATCH: Support Windows in event-loop.c
On Fri, Apr 22, 2005 at 11:14:18AM -0400, Ian Lance Taylor wrote:
>Christopher Faylor <me@cgf.cx> 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.
That's roughly how cygwin does it, too.
cgf