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


ExInterlockedInsertHeadList routine

The ExInterlockedInsertHeadList routine atomically inserts an entry at the beginning of a doubly linked list of LIST_ENTRY structures.

Syntax

PLIST_ENTRY ExInterlockedInsertHeadList(
  _Inout_ PLIST_ENTRY ListHead,
  _Inout_ PLIST_ENTRY ListEntry,
  _Inout_ PKSPIN_LOCK Lock
);

Parameters

  • ListHead [in, out]
    A pointer to the LIST_ENTRY structure that serves as the list header.

  • ListEntry [in, out]
    A pointer to the LIST_ENTRY structure that represents the entry to be inserted into the list.

  • Lock [in, out]
    A pointer to a KSPIN_LOCK structure that serves as the spin lock used to synchronize access to the list. The storage for the spin lock must be resident and must have been initialized by calling KeInitializeSpinLock. You must use this spin lock only with the ExInterlockedXxxList routines.

Return value

ExInterlockedInsertHeadList returns a pointer to the first entry of the list before the new entry was inserted. If the list was empty, the routine returns NULL.

Remarks

ExInterlockedInsertHeadList performs the same operation as InsertHeadList, but atomically. Do not mix atomic and non-atomic calls on the same list.

For more information about using this routine to implement a doubly linked list, see Singly and Doubly Linked Lists.

The ExInterlockedInsertHeadList routine can be called at any IRQL. The storage for the ListHead parameter and the list entries must be resident at all IRQLs.

Requirements

Target platform

Universal

Version

Available starting with Windows 2000.

Header

Wdm.h (include Wdm.h, Ntddk.h, or Ntifs.h)

Library

NtosKrnl.lib

DLL

NtosKrnl.exe

IRQL

Any level (see Remarks section)

DDI compliance rules

IoAllocateFree, IoReuseIrp, MarkingInterlockedQueuedIrps, RemoveLockCheck, RemoveLockForward, RemoveLockForward2, RemoveLockForwardDeviceControl, RemoveLockForwardDeviceControl2, RemoveLockForwardDeviceControlInternal, RemoveLockForwardDeviceControlInternal2, RemoveLockForwardRead, RemoveLockForwardRead2, RemoveLockForwardWrite, RemoveLockForwardWrite2, RemoveLockRelease2, RemoveLockReleaseCleanup, RemoveLockReleaseClose, RemoveLockReleaseCreate, RemoveLockReleaseDeviceControl, RemoveLockReleaseInternalDeviceControl, RemoveLockReleasePower, RemoveLockReleaseRead, RemoveLockReleaseShutdown, RemoveLockReleaseSystemControl, RemoveLockReleaseWrite

See also

ExInterlockedInsertTailList

ExInterlockedRemoveHeadList

InitializeListHead

InsertHeadList

KeInitializeSpinLock

 

 

Send comments about this topic to Microsoft