KeTryToAcquireSpinLockAtDpcLevel function (wdm.h)

The KeTryToAcquireSpinLockAtDpcLevel routine attempts to acquire a spin lock at DISPATCH_LEVEL.

Syntax

BOOLEAN KeTryToAcquireSpinLockAtDpcLevel(
  [in, out] PKSPIN_LOCK SpinLock
);

Parameters

[in, out] SpinLock

Specifies the spin lock to acquire. The spin lock must have already been initialized by KeInitializeSpinLock.

Return value

KeTryToAcquireSpinLockAtDpcLevel returns TRUE if the spin lock has been acquired, and FALSE if the spin lock is already being held and cannot be acquired.

Remarks

If the specified spin lock is not busy, the KeTryToAcquireSpinLockAtDpcLevel routine acquires the spin lock (see KeAcquireSpinLock for details) and returns TRUE. If the spin lock has already been acquired, the routine immediately returns FALSE.

If the spin lock is acquired, the caller can release it by using the KeReleaseSpinLock routine.

If you want the driver to block when it is unable to acquire the spin lock, use KeAcquireSpinLockAtDpcLevel instead.

For more information about spin locks, see Spin Locks.

Requirements

Requirement Value
Minimum supported client Available in Windows Server 2003 with Service Pack 1 (SP1) 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 DISPATCH_LEVEL
DDI compliance rules HwStorPortProhibitedDDIs(storport), SpinLock(wdm), SpinlockRelease(wdm)

See also

KeAcquireSpinLock

KeAcquireSpinLockAtDpcLevel

KeInitializeSpinLock

KeReleaseSpinLock