I believe many of you have banged your head against the wall when you discovered that win32 pipes and file handles don't work together with select() -- only sockets do. Me too. Now, I was thinking, I could fork off a thread, that would listen on a f.ex udp port, would repeatedly call WaitForMultipleObjects (or Win32::IPC::wait_for_any, if that works), and send a dummy packed to the socket whenever that win32 call reports that some async event occured. That scheme would enable the main thread to use select(), of course with some wrappings, but still, it would be a full-weight select, that would work with pipes, handles, and any other win32 async machinery such as mutexes, semaphores, processes etc etc.
Now I have a question. My alpha prototype shows that the concept works. I am unsure however if I'm reinventing the wheel, mainly because the problem is very old, and I doubt that no one ever approached it. The solutions I've seen are partial, like IPC::Run that works for async execution only. Of course there's cygwin where select() just works. So my question is, do you know a module, or a common technique that solves this problem? Or, possibly you know that the problem (or expected solution) covers more than just pipes/filehandles/win32 objects?
Thank you!
ps. Usually people ask why. Here's why: event loop modules don't seem to work with non-blocking open("-|"). Basically, now I want a non-blocking version of system(), but possibly I'll also need the same for IPC::Open2 .
In reply to win32 and select by dk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |