VOID
NdisDprAcquireSpinLock(
IN PNDIS_SPIN_LOCK SpinLock
);
NdisDprAcquireSpinLock acquires a spin lock so the caller can synchronize access to resources shared among nonISR driver functions in a multiprocessor-safe way.
Parameters
SpinLock
Points to an opaque spin lock, already initialized by the caller.
Comments
The NIC driver must initialize a variable of type NDIS_SPIN_LOCK with NdisAllocateSpinLock before it calls any other Ndis..SpinLock function. The driver must provide resident storage for the spin lock(s) it uses.
NdisDprAcquireSpinLock is an optimized version of NdisAcquireSpinLock that a miniport can call only while running at IRQL DISPATCH_LEVEL.
After acquiring a spin lock with NdisDprAcquireSpinLock, the caller must release that lock with a call to NdisDprReleaseSpinLock. A NIC driver must call NdisDprReleaseSpinLock following each call to NdisDprAcquireSpinLock. Otherwise, a deadlock occurs, hanging the driver.
A spin lock acquired with NdisDprAcquireSpinLock must be released with NdisDprReleaseSpinLock. A spin lock acquired with NdisAcquireSpinLock must be released with NdisReleaseSpinLock.
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. Instead, a miniport must call NdisMSynchronizeWithInterrupt so that its MiniportSynchronizeISR function accesses such shared resources at the same DIRQL at which its MiniportISR and/or MiniportDisableInterrupt functions do.
Callers of NdisDprAcquireSpinLock must be running at IRQL DISPATCH_LEVEL.
See Also
MiniportDisableInterrupt, MiniportISR, MiniportSynchronizeISR, MiniportTimer, NdisAcquireSpinLock, NdisAllocateSpinLock, NdisDprReleaseSpinLock, NdisMSynchronizeWithInterrupt