Export (0) Print
Expand All

KeInsertQueue routine

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(
  _Inout_  PRKQUEUE Queue,
  _Inout_  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

Header

Ntifs.h (include Ntifs.h)

Library

Ntoskrnl.lib

IRQL

<= DISPATCH_LEVEL

See also

ExAllocateFromNPagedLookasideList
ExAllocatePoolWithTag
ExInitializeNPagedLookasideList
KeInitializeQueue
KeInsertHeadQueue
KeRemoveQueue

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft