views:

256

answers:

3

can anyone please tell me what is the return value of WaitForObject() function .
I do not mean the type of return value (int ) . What does it return if the event is signalled and what does it return if the event is not signalled .

Thanks

+3  A: 

There is no WaitForObject function. I assume that you mean either WaitForSingleObject or WaitForMultipleObjects.

WaitForSingleObject will return WAIT_TIMEOUT, WAIT_OBJECT_0 or WAIT_ERROR. WaitForMultipleObjects will return WAIT_TIMEOUT, WAIT_OBJECT_0 + n (where n is the index to the object in the array) or WAIT_ERROR.

Roger Lipscombe
A: 

Thanks Roger .

Rakesh Agarwal
A: 

This question isn't c++. c++ has no API called WaitForObject(). The Windows API has a function called WaitForSingleObject and another called WaitForMultipleObjects. These functions return -1 on failure, 0 if the first object in the array is signalled, and a number >= 0x80 if the wait times out or is abandoned. (0x80 if abandoned, 0x102 if there is a timeout).

Chris Becke