Home > Software engineering >  A about WaitForMultipleObjects (), hope comment!
A about WaitForMultipleObjects (), hope comment!

Time:10-11

 
int index;
While (1)
{
Index=WaitForMultipleObjects (10, phNormal, false, INFINITE).
NIndex=nIndex - WAIT_OBJECT_0;
The CloseHandle (phNormal [nIndex]);
}

Such as parameter Settings, suppose I wait ten end of the process, the 10 process has been created, respectively is a process phNormal [0] ~ phNormal [9],

Situations like this:
Cycle for the first time, if over, at the same time there are three process is 1, 2, and 3, respectively, then WaitForMultipleObjects () returns a value, refers to the phNormal [1] quits, i.e. waiting for the object, the object sets minimum this I understand.

Then enter the second loop, assuming no other process exits, then the last cycle has withdrawn from process of no. 2 and 3 can be WaitForMultipleObjects wait ()? The phNormal [2] has withdrawn from information, also can be WaitForMultipleObjects () to catch??

(e.g., what didn't fully clear, still hope to point out mistakes,)

CodePudding user response:

Otherwise, what is the point of this API? You can easily verify...

CodePudding user response:

Read "Windows core programming"

CodePudding user response:

reference 1st floor yaozhiyong110 response:
can otherwise, what is the point of this API? You can easily verify...

You can't, need to clear away has the returned handle, or you will return to the minimum, have been tested
  • Related