KeReadStateSemaphore function (wdm.h)

The KeReadStateSemaphore routine returns the current state, signaled or not-signaled, of the specified semaphore object.

Syntax

LONG KeReadStateSemaphore(
  [in] PRKSEMAPHORE Semaphore
);

Parameters

[in] Semaphore

Pointer to an initialized semaphore object for which the caller provides the storage.

Return value

If the return value is zero, the semaphore object is set to a not-signaled state.

Remarks

This routine provides an efficient way to poll the signal state of a semaphore. KeReadStateSemaphore reads the state of the semaphore without synchronizing its access to the semaphore. Do not assume that accesses of a semaphore state by KeReadStateSemaphore are mutually exclusive of accesses by routines, such as KeReleaseSemaphore and KeWaitForSingleObject, that do synchronize their access to the semaphore state.

For more information about semaphore objects, see Semaphore Objects.

Requirements

Requirement Value
Minimum supported client Available starting with Windows 2000.
Target Platform Universal
Header wdm.h (include Wdm.h, Ntddk.h, Ntifs.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
IRQL Any level
DDI compliance rules HwStorPortProhibitedDDIs(storport)

See also

KeInitializeSemaphore

KeReleaseSemaphore

KeWaitForSingleObject