ExInterlockedPushEntrySList

PSINGLE_LIST_ENTRY
    ExInterlockedPushEntrySList(

        IN PSLIST_HEADER  ListHead,
        IN PSINGLE_LIST_ENTRY  ListEntry,
        IN PKSPIN_LOCK  Lock
        );

ExInterlockedPushEntrySList inserts an entry at the head of a sequenced, singly linked list so access to the list is synchronized in a multiprocessor-safe way.

Parameters

ListHead
Points to the head of the sequenced, singly linked list into which the specified entry is to be inserted.
ListEntry
Points to the entry to be inserted.
Lock
Points to a caller-supplied spin lock.

Return Value

ExInterlockedPushEntrySList returns a pointer to the previous first entry in the list. If the list was previously empty, this routine returns NULL.

Comments

ExInterlockedPushEntrySList inserts ListEntry at the head of the list. Prior to calling this routine, the list should be initialized with ExInitializeSListHead.

The caller must provide resident storage for the Lock, which must be initialized with KeInitializeSpinLock before the initial call to an ExInterlocked..SList routine. The spin lock is not used on platforms that support an 8-byte compare exchange operation, but the spin lock must be provided on any ExInterlocked..SList call.

Drivers that retry I/O operations should use a doubly linked interlocked queue and the ExInterlockedInsert/Remove..List routines.

Callers of ExInterlockedPushEntrySList should be running at IRQL <= DISPATCH_LEVEL.

See Also

ExInitializeSListHead, ExInterlockedPopEntrySList, ExQueryDepthSListHead, KeInitializeSpinLock