KeAcquireInterruptSpinLock routine

The KeAcquireInterruptSpinLock routine acquires the spin lock associated with an interrupt object.

Syntax


KIRQL KeAcquireInterruptSpinLock(
  _Inout_ PKINTERRUPT Interrupt
);

Parameters

Interrupt [in, out]

Specifies a pointer to an interrupt object. This value must be supplied by IoConnectInterrupt or IoConnectInterruptEx.

Return value

KeAcquireInterruptSpinLock returns the current IRQL at the time the routine is called. This value is passed to KeReleaseInterruptSpinLock when the spin lock is released.

Remarks

Drivers use the interrupt spin lock to synchronize access to memory shared with the interrupt's ISR. The driver can release the spin lock by calling KeReleaseInterruptSpinLock.

Any code that executes while the interrupt spin lock is held does so at IRQL = DIRQL for the specified Interrupt, so it must execute very quickly. For more information, see Using Critical Sections.

The preferred way to synchronize a driver routine to an ISR is to use the KeSynchronizeExecution routine.

Starting with Windows 8, a driver can use IoConnectInterruptEx to register an interrupt service routine that runs at IRQL = PASSIVE_LEVEL and that does not use a spin lock for interrupt synchronization. If Interrupt points to an interrupt object that connects to a passive-level ISR, KeAcquireInterruptSpinLock causes a bug check. For more information, see Using Passive-Level Interrupt Service Routines.

Callers must be running at IRQL <= DIRQL for Interrupt. (This is the value the driver passed as the SynchronizeIrql parameter of IoConnectInterrupt when Interrupt is created.)

Requirements

Target platform

Universal

Version

Available in Windows XP and later versions of Windows.

Header

Wdm.h (include Wdm.h, Ntddk.h, or Ntifs.h)

Library

NtosKrnl.lib

DLL

NtosKrnl.exe

IRQL

<= DIRQL (see Remarks section)

DDI compliance rules

HwStorPortProhibitedDDIs

See also

IoConnectInterrupt
KeReleaseInterruptSpinLock
KeSynchronizeExecution

 

 

Send comments about this topic to Microsoft

Show: