Multithreading Multi-Threaded Programming
Multithreading Multi-Threaded Programming
Multithreading Multi-Threaded Programming
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
WaitFor<strong>Multi</strong>pleObjects in worker thread<br />
HANDLE hEventArray[3];<br />
…<br />
DWORD Event = 0;<br />
// If the 3rd parameter is TRUE, the function returns when the state of all objects in the lpHandles array<br />
is signaled. If FALSE, the function returns when the state of any one of the objects is set to signaled. In<br />
the latter case, the return value indicates the object whose state caused the function to return.<br />
Event = WaitFor<strong>Multi</strong>pleObjects(3, hEventArray, FALSE, INFINITE);<br />
switch (Event)<br />
{<br />
case WAIT_OBJECT_0 : …<br />
case WAIT_OBJECT_0 + 1: …<br />
case WAIT_OBJECT_0 + 2: …<br />
}<br />
30<br />
Advanced Windows Network <strong>Programming</strong><br />
11/11/12