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

Re: [libvirt] mingw: test-poll pipe part fails

[adding libvirt]

On 06/04/2011 12:24 AM, Paolo Bonzini wrote:
> On Sat, Jun 4, 2011 at 00:37, Matthias Bolte
> <matthias bolte googlemail com> wrote:
>> After testing a while and reading MSDN docs the problem seems to be
>> that MsgWaitForMultipleObjects doesn't work on pipes. It doesn't
>> actually wait but just returns immediately. Digging MSDN and googling
>> about this suggest that there is no simple solution to this.
> 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

Eric Blake   eblake redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

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