The ExInterlockedRemoveHeadList routine removes an entry from the head of a doubly linked list so that access to this queue is synchronized in a multiprocessor-safe way.
PLIST_ENTRY
ExInterlockedRemoveHeadList(
IN PLIST_ENTRY ListHead,
IN PKSPIN_LOCK Lock
);
If the list is empty, a NULL pointer is returned. Otherwise, a pointer to the dequeued entry is returned.
Declared in wdm.h and ntddk.h. Include wdm.h or ntddk.h.
Support routines that do interlocked operations are assumed to be incapable of causing a page fault. That is, neither their code nor any of the data they touch can cause a page fault without bringing down the system. They use spin locks to achieve atomicity in SMP machines. The caller must provide resident storage for the Lock, which must be initialized with KeInitializeSpinLock before the initial call to an ExInterlockedXxx. A caller must not be holding this spin lock when it calls ExInterlockedRemoveHeadList.
The caller also must supply resident storage for the interlocked queue. The ListHead must be initialized with InitializeListHead before the initial call to an ExInterlocked..List routine.
If the caller uses only ExInterlocked..List routines to manipulate the list, these routines can be called from a single IRQL that is <= DIRQL. If other driver routines access the list using any other routines, such as the noninterlocked InsertHeadList, callers of ExInterlocked..List must be at <= DISPATCH_LEVEL.
ExInterlockedInsertHeadList, ExInterlockedInsertTailList, InitializeListHead, KeInitializeSpinLock