Share via


NdisDprAcquireSpinLock (Compact 2013)

3/26/2014

This function acquires a spin lock so that the caller can synchronize access to resources shared among non-ISR driver functions.

Syntax

VOID NdisDprAcquireSpinLock(
  PNDIS_SPIN_LOCK SpinLock
);

Parameters

  • SpinLock
    [in]Pointer to an opaque spin lock, already initialized by the caller.

Return Value

None.

Remarks

The network adapter driver must initialize a variable of type NDIS_SPIN_LOCK with NdisAllocateSpinLock before it calls any other NdisXXXSpinLock function. The driver must provide resident storage for the spin lock(s) it uses.

After acquiring a spin lock with NdisDprAcquireSpinLock, the caller must release that lock with a call to NdisDprReleaseSpinLock. In addition, following each call to NdisDprAcquireSpinLock, a network adapter driver must call NdisDprReleaseSpinLock. Otherwise, a deadlock occurs, causing the driver to not respond.

A driver should never hold a spin lock for an extended period (more than a few instructions). Holding a spin lock for longer than 25 microseconds degrades both system and driver performance.

A miniport driver cannot use a spin lock to protect resources that its other functions share with the MiniportISR and/or MiniportDisableInterrupt functions.

Note

A spin lock acquired with NdisDprAcquireSpinLock must be released with NdisDprReleaseSpinLock. A spin lock acquired with NdisAcquireSpinLock must be released with NdisReleaseSpinLock.

Requirements

Header

ndis.h

Library

ndis.lib

See Also

Reference

NDIS Spin Lock Interface
MiniportDisableInterrupt
MiniportISR
MiniportSynchronizeISR
NdisAcquireSpinLock
NdisAllocateSpinLock
NdisDprReleaseSpinLock
NdisMSynchronizeWithInterrupt
NdisReleaseSpinLock