Share via


KeTryToAcquireSpinLockAtDpcLevel routine

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

Syntax

BOOLEAN KeTryToAcquireSpinLockAtDpcLevel(
  _Inout_ PKSPIN_LOCK SpinLock
);

Parameters

  • SpinLock [in, out]
    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.

Remarks

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 KeReleaseSpinLock routine.

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

For more information about spin locks, see Spin Locks.

Requirements

Target platform

Universal

Version

Available in Windows Server 2003 with Service Pack 1 (SP1) and later versions of Windows.

Header

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

Library

NtosKrnl.lib

DLL

NtosKrnl.exe

IRQL

DISPATCH_LEVEL

DDI compliance rules

SpinLock, SpinlockRelease, HwStorPortProhibitedDDIs

See also

KeAcquireSpinLock

KeAcquireSpinLockAtDpcLevel

KeInitializeSpinLock

KeReleaseSpinLock

 

 

Send comments about this topic to Microsoft