Previous Next

KeAcquireSpinLockAtDpcLevel

The KeAcquireSpinLockAtDpcLevel routine acquires a spin lock when the caller is already running at IRQL = DISPATCH_LEVEL.

VOID 
  KeAcquireSpinLockAtDpcLevel(
    IN PKSPIN_LOCK  SpinLock
    );

Parameters

SpinLock
Pointer to an initialized spin lock for which the caller must provide the storage.

Return Value

None

Headers

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

Comments

Drivers for Windows XP and later should use the more efficient and reliable queued spin locks, which are acquired at IRQL = DISPATCH_LEVEL by the KeAcquireInStackQueuedSpinLockAtDpcLevel routine.

Drivers call KeAcquireSpinLockAtDpcLevel instead of KeAcquireSpinLock for better driver performance if and only if they are already running at IRQL = DISPATCH_LEVEL.

If a driver is running at IRQL < DISPATCH_LEVEL, it should call KeAcquireSpinLock to have IRQL raised by that routine. KeAcquireSpinLockAtDpcLevel assumes the caller is already running at IRQL = DISPATCH_LEVEL, so no raise is necessary.

The caller should release the spin lock with KeReleaseSpinLockFromDpcLevel as quickly as possible.

See Also

KeAcquireInStackQueuedSpinLockAtDpcLevel, KeAcquireSpinLock, KeInitializeSpinLock, KeReleaseSpinLock, KeReleaseSpinLockFromDpcLevel, KeTryToAcquireSpinLockAtDpcLevel