Share via


NdisAcquireSpinLock

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

For Windows CE, note the following:

  • NDIS spin locks are implemented using critical sections.
  • A single miniport lock exists for a miniport that is held when any of the MiniportXXX functions runs, except for MiniportInitialize and MiniportHalt. Typically, it is not necessary to have separate driver created locks. In particular, the MiniportISR handler is run with the miniport lock held, so the use of NdisMSynchronizeWithInterrupt is unnecessary.

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 lock(s) 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.

Requirements

Runs on Versions Defined in Include Link to
Windows CE OS 2.0 and later Ndis.h   Ndislib.lib

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

MiniportHalt,MiniportInitialize,MiniportISR,NdisAllocateSpinLock,NdisDprAcquireSpinLock, NdisDprReleaseSpinLock, NdisMSynchronizeWithInterrupt, NdisReleaseSpinLock

 Last updated on Tuesday, July 13, 2004

© 1992-2000 Microsoft Corporation. All rights reserved.