The KeReadStateSemaphore routine returns the current state, signaled or not-signaled, of the specified semaphore object.
LONG KeReadStateSemaphore( _In_ PRKSEMAPHORE Semaphore );
Pointer to an initialized semaphore object for which the caller provides the storage.
If the return value is zero, the semaphore object is set to a not-signaled state.
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.
|Windows version||Available starting with Windows 2000.|
|Header||wdm.h (include Wdm.h, Ntddk.h, Ntifs.h)|
|DDI compliance rules||HwStorPortProhibitedDDIs|