Microsoft Windows CE 3.0  

NdisAcquireSpinLock

Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

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(
IN PNDIS_SPIN_LOCK
SpinLock
);

Parameters

SpinLock
Pointer to an opaque spin lock, already initialized by the caller.

Remarks

In Windows CE, NDIS spin locks are implemented using critical sections.

The driver must initialize a variable of type NDIS_SPIN_LOCK with the NdisAllocateSpinLockfunction before it calls any other NDIS SpinLockfunction. The driver must provide resident storage for the spin lock(s) it uses.

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

A spin lock acquired with the NdisDprAcquireSpinLockfunction must be released with the NdisDprReleaseSpinLockfunction.

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 MiniportISRand/or the MiniportDisableInterruptfunctions. Instead, a miniport must call the NdisMSynchronizeWithInterruptfunction so that its MiniportSynchronizeISRfunction accesses such shared resources at the same DIRQL at which its MiniportISRand/or MiniportDisableInterruptfunctions do.

A driver that calls this function runs 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

NdisDprAcquireSpinLock, NdisMSynchronizeWithInterrupt, NdisReleaseSpinLock



 Last updated on Tuesday, July 13, 2004

© 2004 Microsoft Corporation. All rights reserved.