Condividi tramite


NdisAcquireSpinLock (Windows CE 5.0)

Send Feedback

This function acquires a spin lock so that the caller gains exclusive access to the resources, shared among driver functions, that the spin lock protects.

VOID NdisAcquireSpinLock(PNDIS_SPIN_LOCKSpinLock);

Parameters

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

Return Values

None.

Remarks

In the Microsoft® Windows® CE operating system (OS), NDIS spin locks are implemented using critical sections.

The driver must initialize a variable of type NDIS_SPIN_LOCK with the NdisAllocateSpinLock function before it calls any other NDIS SpinLock function. The driver must provide resident storage for the spin locks it uses.

After acquiring a spin lock with this function, the caller releases that lock with a call to the NdisReleaseSpinLock function. A driver must call NdisReleaseSpinLock following each call to this function. Otherwise, a deadlock occurs, hanging the driver.

A spin lock acquired with the NdisDprAcquireSpinLock function must be released with the NdisDprReleaseSpinLock function.

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 the MiniportDisableInterrupt functions. Instead, a miniport must call the NdisMSynchronizeWithInterrupt function so that its MiniportSynchronizeISR function does not access shared resources at the same time as its MiniportISR or MiniportDisableInterrupt function.

Requirements

OS Versions: Windows CE .NET 4.0 and later.
Header: Ndis.h.
Link Library: Ndis.lib

See Also

MiniportDisableInterrupt | MiniportISR | MiniportSynchronizeISR | NdisAllocateSpinLock | NdisDprAcquireSpinLock | NdisDprReleaseSpinLock | NdisMSynchronizeWithInterrupt

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.