RtkWaitForMultipleObjects

RtkWaitForMultipleObjects allows a thread to wait on one of multiple objects to be signaled.

Syntax

NTSTATUS RtkWaitForMultipleObjects(
    RTSSINST RtssInst,
    ULONG Count,
    CONST HANDLE *Handles,
    BOOLEAN WaitAll,
    ULONG Milliseconds
);

Parameters

RtssInst

An RTSSINST value returned from a call to RtkRtssAttach or RtkRtssAttachEx. Must pass in a valid RTSSINST value or the call will fail with STATUS_INVALID_PARAMETER.

Count

Specifies the number of object handles in the array pointed by Handles. The maximum number of object handles is MAX_WFMO, defined in RtkApi.h.

Handles

An array of handles to open object handles. See the list of the object types whose handles can be specified in the Comments section. If one of these handles is closed while the wait is still pending, the function’s behavior is undefined.

WaitAll

Ignored. Specifies the wait type. This is always FALSE, the function returns when the state of any one of the objects is set to signaled. The return value indicates the object whose state caused the function to return.

Milliseconds

The time-out interval, in milliseconds. The function returns if the interval elapses, even if the object's state is non-signaled. If Milliseconds is zero, the function tests the object's state and returns immediately. If Milliseconds is INFINITE, the function's time-out interval never elapses.

Return Value

RtkWaitForMultipleObjects returns the following error codes:

Return Value Meaning

STATUS_WAIT_0 to (STATUS_WAIT_0 + Count - 1)

The return value minus STATUS_WAIT_0 indicates the Handles array index of the object that satisfied the wait. If more than one object became signaled during the call, this is the array index of the signaled object with the smallest index value of all the signaled objects.

STATUS_ABANDONED_WAIT_0 to (STATUS_ABANDONED_WAIT_0 + Count - 1)

The return value minus STATUS_ABANDONED_WAIT_0 indicates the Handles array index of an abandoned mutex object that satisfied the wait.

STATUS_TIMEOUT

The time-out interval elapsed and the conditions specified by the WaitAll parameter are not satisfied.

STATUS_UNSUCCESSFUL

If the function fails to wait.

STATUS_INVALIDPARAMETER

If functions fails with invalid parameter.

Remarks

RtkWaitForMultipleObjects determines whether the wait criteria has been met. If the criteria has not been met, the calling thread enters the wait state. It uses no processor time while waiting for the criteria to be met.

The function returns when one of these events occurs:

The function modifies the state of some synchronization objects. Modification occurs only for the object or objects whose signaled state caused the function to return. For example, the count of a semaphore object is decreased by one.

RtkWaitForMultipleObjects can specify handles of any of the following object types in the Handles array:

Requirements

Minimum Supported Version RTX64 2013 with Service Pack 1
Header RtkApi.h
Library RtkApi.lib
IRQL PASSIVE_LEVEL

See Also:

RtkCreateMutex

RtkCreateSemaphore

RtkOpenMutex

RtkOpenSemaphore