KeAcquireInStackQueuedSpinLockAtDpcLevel - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
// wdm.h

VOID KeAcquireInStackQueuedSpinLockAtDpcLevel(
  PKSPIN_LOCK         SpinLock,
  PKLOCK_QUEUE_HANDLE LockHandle
);

View the official Windows Driver Kit DDI reference

NtDoc

No description available.

Windows Driver Kit DDI reference (nf-wdm-keacquireinstackqueuedspinlockatdpclevel)

Description

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

Parameters

SpinLock

[in, out] Specifies the spin lock to acquire. This parameter must have been initialized by a call to the KeInitializeSpinLock routine.

LockHandle

[out] Pointer to a caller-supplied KLOCK_QUEUE_HANDLE structure that the routine can use to return the spin lock queue handle. To release the lock, the caller passes this value to the KeReleaseInStackQueuedSpinLockFromDpcLevel routine.

Remarks

For a driver running at IRQL >= DISPATCH_LEVEL, KeAcquireInStackQueuedSpinLockAtDpcLevel acquires a spin lock as a queued spin lock. For more information, see Queued Spin Locks. To release the spin lock, call the KeReleaseInStackQueuedSpinLockFromDpcLevel routine.

Drivers that are already running at an IRQL >= DISPATCH_LEVEL can call this routine to acquire the queued spin lock more quickly. Otherwise, use the KeAcquireInStackQueuedSpinLock routine to acquire the spin lock.

For a driver that is running at IRQL > DISPATCH_LEVEL, this routine acquires the lock without modifying the current IRQL. For a driver that is running at IRQL = DISPATCH_LEVEL, this routine improves performance by acquiring the lock without first setting the IRQL to DISPATCH_LEVEL, which, in this case, would be a redundant operation.

Like ordinary spin locks, queued spin locks must only be used in very special circumstances. For a description of when to use spin locks, see KeAcquireSpinLock.

Drivers must not combine calls to KeAcquireSpinLock and KeAcquireInStackQueuedSpinLock on the same spin lock. A spin lock must always be acquired or released either as a queued spin lock, or as an ordinary spin lock.

See also

KLOCK_QUEUE_HANDLE

KeAcquireSpinLock

KeAcquireInStackQueuedSpinLock

KeInitializeSpinLock

KeReleaseInStackQueuedSpinLockFromDpcLevel