2011/5/25 Matthias Bolte <matthias.bo...@googlemail.com>: > Output from a test run on mingw > > Unconnected socket test... passed > Connected sockets test... passed > General socket test with fork... passed > Pipe test... failed (expecting POLLHUP after shutdown) > FAIL: test-poll.exe > > This affects the attempt to make libvirtd working on Windows. libvirtd > relies on poll blocking on a pipe until an event occurs when calling > poll with a timeout of -1. But poll doesn't behave that way under > mingw.
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. Eric Blake suggested some approaches to this problem on IRC: <eblake> it should be possible to wrap an event object around pipe fds, such that WaitForMultipleObjects wakes if the event fires, while the event fires if the pipe changes state <eblake> maybe another approach would be to get the gnulib emulation of anonymous socketpair() working on mingw by using IPv4 loopback sockets <eblake> and use sockets to emulate pipes <eblake> that is, mingw pipe() could wrap socketpair(), at which poll on "pipe" fds works <eblake> again, not trivial, but certainly worth raising as an idea on the gnulib list Anyone else an idea or suggestion on this problem? Matthias