Re: RFA: Various Windows (mingw32) additions, mostly relating to select or serial ports

Ian Lance Taylor
2006-02-04T06:28:25Z

Daniel Jacobowitz <drow@false.org> writes:

> The one I'm least proud of is pipes - there does not appear to be a way to
> sleep and have the OS wake you when data is available on a pipe. So I poll
> every 10ms in a thread. Yuck! The other three all have subtly different
> wait mechanisms.

Why do you have to poll? You should be able to have a thread which
just sleeps on reading the pipe. When the thread reads something, it
can signal the main thread, passing it the character which it read.

The cleanest portable event loop which I know of is Tcl. The Tcl code
has solved pretty much all the event loop issues for Unix, Windows,
and MacOS 9.

Ian