NdisDprAcquireSpinLock
This function acquires a spin lock so that the caller can synchronize access to resources shared among driver functions not related to interrupts.
VOID NdisDprAcquireSpinLock(
IN PNDIS_SPIN_LOCK SpinLock );
Parameters
- SpinLock
Pointer to an opaque spin lock, already initialized by the caller.
Remarks
In Windows CE, NDIS spinlocks are implemented using critical sections.
The NIC driver must initialize a variable of type NDIS_SPIN_LOCK with the NdisAllocateSpinLock function before it calls any other NdisXXXSpinLock function. The driver must provide resident storage for the spin lock(s) it uses.
This function is an optimized version of NdisAcquireSpinLock that a miniport can call only while running at IRQL DISPATCH_LEVEL.
After acquiring a spin lock with this function, the caller must release that lock with a call to the NdisDprReleaseSpinLock function. An NIC driver must call NdisDprReleaseSpinLock following each call to this function. Otherwise, a deadlock occurs, hanging the driver.
A spin lock acquired with this function 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 the NdisMSynchronizeWithInterrupt function so that its MiniportSynchronizeISR function accesses such shared resources at the same DIRQL at which its MiniportISR and/or MiniportDisableInterrupt functions do.
A driver that calls this function must be running at IRQL DISPATCH_LEVEL.
Requirements
Runs on | Versions | Defined in | Include | Link to |
---|---|---|---|---|
Windows CE OS | 2.0 and later | Ndis.h |
Note This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.
See Also
NdisAcquireSpinLock, NdisDprReleaseSpinLock, NdisMSynchronizeWithInterrupt
Last updated on Tuesday, July 13, 2004
© 1992-2000 Microsoft Corporation. All rights reserved.