ExInterlockedInsertTailList function (wdm.h)
The ExInterlockedInsertTailList routine atomically inserts an entry at the end of a doubly linked list of LIST_ENTRY structures.
Syntax
PLIST_ENTRY ExInterlockedInsertTailList(
[in, out] PLIST_ENTRY ListHead,
[in, out] __drv_aliasesMem PLIST_ENTRY ListEntry,
[in, out] PKSPIN_LOCK Lock
);
Parameters
[in, out] ListHead
A pointer to the LIST_ENTRY structure that serves as the list header.
[in, out] ListEntry
A pointer to the LIST_ENTRY structure that represents the entry to be inserted into the list.
[in, out] Lock
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
ExInterlockedInsertTailList returns a pointer to the last entry of the list before the new entry was inserted. If the list was empty, the routine returns NULL.
Remarks
ExInterlockedInsertTailList performs the same operation as InsertTailList, 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 ExInterlockedInsertTailList routine can be called at any IRQL. The storage for the ListHead parameter and the list entries must be resident at all IRQLs.