Поделиться через


NdisInterlockedInsertHeadList (Compact 2013)

3/26/2014

This function inserts an entry, usually a packet, at the head of a doubly linked list so that access to the list is synchronized.

Syntax

PLIST_ENTRY NdisInterlockedInsertHeadList(
  PLIST_ENTRY ListHead,
  PLIST_ENTRY ListEntry,
  PNDIS_SPIN_LOCK SpinLock
);

Parameters

  • ListHead
    [in] Pointer to the head of the doubly linked list into which an entry is to be inserted.
  • ListEntry
    [in] Pointer to the entry to be inserted at the head of the list.
  • SpinLock
    [in] Pointer to a caller-supplied spin lock used to synchronize access to the list.

Return Value

Returns a pointer to the entry that was at the head of the queue before the specified entry was inserted. If the queue was empty, it returns NULL.

Remarks

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

The caller-supplied spin lock prevents any other function from accessing the driver's internal queue while this function is inserting the specified entry, even when the driver is running on a multiprocessor device.

Most NDIS drivers process packets in first-in, first-out (FIFO) order, so any driver that uses an interlocked queue may call the NdisInterlockedInsertTailList function far more frequently than this function. Such a driver usually calls this function only to re-queue a packet for a retry operation.

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

Requirements

Header

ndis.h

Library

ndis.lib

See Also

Reference

NDIS Interlocked Functions Interface
CONTAINING_RECORD
NdisAllocateSpinLock
NdisInitializeListHead
NdisInterlockedInsertTailList
NdisInterlockedRemoveHeadList