[Geany-Devel] [geany/geany] a3664f: Fix spawning [synchronous] commands on Windows
Dimitar Zhekov
dimitar.zhekov at gmail.com
Fri Nov 23 17:45:43 UTC 2012
On Sat, 17 Nov 2012 20:04:39 +0100
Thomas Martitz <thomas.martitz at student.htw-berlin.de> wrote:
> Am 16.11.2012 21:31, schrieb Dimitar Zhekov:
> >
> > Anonymous win~1 pipe fd-s are handled by giowin like regular fd-s
> > (G_IO_WIN32_FILE_DESC), which causes problems, [...]
> FWIW, I recently fought with windows fd-s too, but I don't know if it
> helps in Geany's case. glib's poll() is broken for non-socket fd-s (i.e.
> broken stdout/stdin).
IIRC they block, and simply setting them to non-blocking loads one of
the processor cores at 100%, without delivering meaningful results.
> There is a much better poll implementation for
> win32 available, at pulseaudio (contributed by me, based on gnulib's
> with some fixes). With that you could, in theory, monitor stdout of
> another process in a sensible fashion.
For POLLIN it's the same as mine. Great minds think alike. :)
For POLLOUT, your version is better, except than any fd for which
PeekNamedPipe() returns an error different than ERROR_BROKEN_PIPE is
automatically considered OUT. The problem would be how to integrate
pa_poll() with glib main loop - g_source_add_poll() is not a regular
source, it's supported internally by the context and accesses it's
internal poll fields. Pulse has it's own glib-mainloop, but that's a
bit on the heavy side... For OUT, I simply call write() at 50ms
(configurable), and since Geany on win~1 randomly switches from using
0% CPU time to 6-7%, especially if FF/TB is running, calling write()
20 times per second makes no difference.
--
E-gards: Jimmy
More information about the Devel
mailing list