RtkWaitForSingleObject

RtkWaitForSingleObject allows a thread to wait on an object to be signaled.

Syntax

NTSTATUS RtkWaitForSingleObject(
    RTSSINST RtssInst,
    HANDLE Handle,
    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.

Handle

A handle to an open object handle. See the list of the object types whose handles can be specified in the Comments section.

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

Returns STATUS_SUCCESS on success or an appropriate NTSTATUS error code in failure. Possible return value include the following:

Return Value Meaning

STATUS_ABANDONED_WAIT_0 (WAIT_ABANDONED)

The specified object is a mutex object that was not released by the thread that owned the mutex object before the owning thread terminated. Ownership of the mutex object is granted to the calling thread, and the mutex is set to non-signaled.

STATUS_SUCCESS

The state of the specified object is signaled.

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

RtkWaitForSingleObject checks the current state of the specified object. If the object's state is non-signaled, the calling thread enters an efficient wait state. The thread consumes very little processor time while waiting for the object state to become signaled or the time-out interval to elapse.

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

RtkWaitForSingleObject can wait for the following objects:

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