How do you use WaitForMultipleObjects? Do you have multiple threads reading
from the pipe?
Even without possible bugs I wouldn't rely on Wait functions alone to tell
that non-blocking read is possible. AFAIK there is no guarrantees in MSDN
about when exactly a pipe handle becomes signalled. So your double-check
with PeekNamedPipe seems to be a correct way of doing it. Why do you want to
If you really need asynchronous I/O consider dropping standard library
functions and using ReadFile[Ex] instead.