KeAcquireInStackQueuedSpinLockAtDpcLevel function (wdm.h)

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

Syntax

void KeAcquireInStackQueuedSpinLockAtDpcLevel(
  PKSPIN_LOCK         SpinLock,
  PKLOCK_QUEUE_HANDLE LockHandle
);

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.

Return value

None

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.

Requirements

Requirement Value
Minimum supported client Windows XP
Header wdm.h
IRQL IRQL >= DISPATCH_LEVEL
DDI compliance rules HwStorPortProhibitedDDIs(storport)

See also

KLOCK_QUEUE_HANDLE

KeAcquireSpinLock

KeAcquireInStackQueuedSpinLock

KeInitializeSpinLock

KeReleaseInStackQueuedSpinLockFromDpcLevel