NdisInterlockedRemoveHeadList function

The NdisInterlockedRemoveHeadList function removes an entry, usually a packet, from the head of a doubly linked list so that access to the list is synchronized in a multiprocessor-safe way.

Syntax

void NdisInterlockedRemoveHeadList(
   _ListHead,
   _SpinLock
);

Parameters

_ListHead

A pointer to the head of the doubly linked list from which an entry is to be removed.

_SpinLock

A pointer to a caller-supplied spin lock, used to synchronize access to the list.

Return Value

None

Remarks

Before calling any NdisInterlocked..List function, a driver must initialize the variable at ListHead with the NdisInitializeListHead function and the variable at SpinLock with the NdisAllocateSpinLock function. The driver also must provide resident storage for these variables and for its internal queue.

Before calling NdisInterlockedRemoveHeadList, entries are queued with one or more calls to the NdisInterlockedInsert..List functions.

The caller-supplied spin lock prevents any other function from accessing the driver's internal queue while NdisInterlockedRemoveHeadList is removing an entry, even when the driver is running on a multiprocessor computer.

NdisInterlockedRemoveHeadList raises the IRQL to DISPATCH_LEVEL when it acquires the given spin lock and restores the original IRQL before it returns control. Consequently, any driver function that calls NdisInterlockedRemoveHeadList cannot be pageable code.

To convert a returned value back to the address of the inserted entry, a driver can use the CONTAINING_RECORD macro.

If NdisInterlockedRemoveHeadList is called at IRQL >= DISPATCH_LEVEL, the storage for the ListHead parameter must be resident.

Requirements

   
Windows version Supported for NDIS 6.0 and NDIS 5.1 drivers (see NdisInterlockedRemoveHeadList (NDIS 5.1)) in Windows Vista. Supported for NDIS 5.1 drivers (see NdisInterlockedRemoveHeadList (NDIS 5.1)) in Windows XP.
Target Platform Universal
Header ndis.h (include Ndis.h)
Library Ndis.lib
IRQL Any level

See Also

CONTAINING_RECORD

NdisAllocateSpinLock

NdisInitializeListHead

NdisInterlockedInsertHeadList

NdisInterlockedInsertTailList