bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mingw: test-poll pipe part fails


From: Paolo Bonzini
Subject: Re: mingw: test-poll pipe part fails
Date: Fri, 01 Jul 2011 08:19:44 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc15 Mnenhy/0.8.3 Thunderbird/3.1.10

On 06/30/2011 07:56 PM, Eric Blake wrote:
>  Yes, Windows pipes are that broken.:(
>
>  Using socketpair is a possibly good idea, but I would do it on
>  libvirtd only.  I don't know exactly how libvirtd uses this pipe, but
>  perhaps it can be changed to an eventfd-like abstraction that can be
>  used with both Windows and Unix.  This is similar to Eric's
>  suggestion, but without the pipe at all.  It would also be a
>  libvirtd-specific suggestion.

I'm wondering if the problem here is that libvirt is trying to use the
pipe-to-self mechanism as a fundamental event loop idiom.  That is, the
reason libvirt is calling poll is in order to minimize CPU until
something interesting happens, where interesting includes needing to
wake up a helper thread to do an action inside locks in response to the
receipt of a signal.

Maybe you are on to something, and replacing all uses of pipe() with
virPipeToSelf() (which uses pipe() for efficiency on Linux, but
socketpair() on mingw), would allow libvirt to continue to use the
pipe-to-self idiom while also using fds that can actually be poll'd on
mingw.

Perhaps gnulib can provide an eventfd abstraction (or better, a slight variation that only returns 0/1) to be used for pipe-to-self. In Windows it can use an autoreset event, in Linux an eventfd, in Unix a pipe.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]