KeInsertQueue function (ntifs.h)

The KeInsertQueue routine inserts an entry at the tail of the given queue if it cannot immediately use the entry to satisfy a thread wait.

Syntax

LONG KeInsertQueue(
  PRKQUEUE    Queue,
  PLIST_ENTRY Entry
);

Parameters

Queue

[in, out] Pointer to an initialized queue object for which the caller provides resident storage in nonpaged pool.

Entry

[in, out] Pointer to an entry to be queued. This pointer must be a resident system-space address.

Return value

KeInsertQueue returns the previous signal state of the given Queue. If it was set to zero (that is, not signaled) before KeInsertQueue was called, KeInsertQueue returns zero, meaning that no entries were queued. If it was nonzero (signaled), KeInsertQueue returns the number of entries that were queued before KeInsertQueue was called.

Remarks

Entries to be queued by KeInsertQueue must be allocated from nonpaged pool. For example, memory for caller-defined entries can be allocated with ExAllocatePoolWithTag. If the caller allocates entries of a fixed size, creating a lookaside list with ExInitializeNPagedLookasideList and allocating from it with ExAllocateFromNPagedLookasideList is more efficient than making frequent calls to ExAllocatePoolWithTag, particularly for entries whose size is not a multiple of PAGE_SIZE.

If any threads are waiting on the queue object when KeInsertQueue is called, a single thread's wait is satisfied by this call. The thread is dispatched for execution with the given Entry pointer.

If no threads are currently waiting on the queue object when KeInsertQueue is called, the given entry is inserted in the queue, and the queue object's signal state is incremented.

For more information about using driver-managed internal queues, see Driver-Managed Queues.

Requirements

   
Target Platform Universal
Header ntifs.h (include Ntifs.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
IRQL <= DISPATCH_LEVEL

See also

ExAllocateFromNPagedLookasideList

ExAllocatePoolWithTag

ExInitializeNPagedLookasideList

KeInitializeQueue

KeInsertHeadQueue

KeRemoveQueue