KeTestSpinLock function

The KeTestSpinLock routine tests for the availability of a spin lock.


BOOLEAN KeTestSpinLock(
  _In_ PKSPIN_LOCK SpinLock



A pointer to a spin lock. The spin lock must have been initialized by calling KeInitializeSpinLock.

Return Value

KeTestSpinLock returns FALSE if the spin lock is currently being held. Otherwise, it returns TRUE.


This routine enables the caller that is running at a low IRQL to test the spin lock. If KeTestSpinLock returns TRUE, the caller can try to acquire the spin lock with a high probability of immediate success.

This routine neither raises nor lowers the IRQL, and it never acquires the spin lock.

For more information about spin locks, see Spin Locks.


Windows version Available in Windows Server 2003 and later versions of Windows.
Target Platform Universal
Header wdm.h (include Wdm.h, Ntddk.h, Ntifs.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
IRQL See Remarks section.
DDI compliance rules HwStorPortProhibitedDDIs

See Also




Send comments about this topic to Microsoft