Rakesh Agarwal
Rakesh Agarwal

Reputation: 3059

Return value of WaitForObject

What is the return value of the 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?

Upvotes: 0

Views: 911

Answers (2)

Chris Becke
Chris Becke

Reputation: 36016

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).

Upvotes: 0

Roger Lipscombe
Roger Lipscombe

Reputation: 91805

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.

Upvotes: 3

Related Questions