I use overlapped i/o in a windows program. I use one pipe from multiple threads and write to it.

In this a special case the threads should only continue when the complete information is written to the pipe. In other words: When GetOverlappedResult returns with the last parameter (bWait)set to TRUE returns.

My OVERLAPPED structure doesn't use an event, so hEvent is NULL.

Question: Is this a problem or has this performance issues when I don't use a hEvent?

Reason why I ask is the documentation that says:

If the hEvent member of the OVERLAPPED structure is NULL, the system uses the state of the hFile handle to signal when the operation has been completed. Use of file, named pipe, or communications-device handles for this purpose is discouraged. It is safer to use an event object because of the confusion that can occur when multiple simultaneous overlapped operations are performed on the same file, named pipe, or communications device. In this situation, there is no way to know which operation caused the object's state to be signaled.

The last sentence sounds to me, that the system may wake up my thread erroneously and puts it to sleep again, because my specific operation isn't done. This sounds like that the complete system is more efficient, when I use a hEvent, even if I don't need it, because I set bWait to TRUE.

PS: Don't ask me why I use such a way of blocking i/o, it is by design (even it may bad design), so this isn't the question!

PPS: As documented each overlapped i/o in my program uses it's own OVERLAPPED struct.

0

There are 0 answers