Previous Next

KeTryToAcquireSpinLockAtDpcLevel

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

NTKERNELAPI
BOOLEAN
FASTCALL
  KeTryToAcquireSpinLockAtDpcLevel (
    IN PKSPIN_LOCK  SpinLock
    );

Parameters

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.

Headers

Declared in wdm.h and ntddk.h. Include wdm.h or ntddk.h.

Comments

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 KeReleaseSpinLockroutine.

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

Callers of this routine must be running at IRQL = DISPATCH_LEVEL.

See Also

KeAcquireSpinLock, KeAcquireSpinLockAtDpcLevel, KeInitializeSpinLock, KeReleaseSpinLock