Windows Driver Kit: Installable File System Drivers
KeInitializeQueue

The KeInitializeQueue routine initializes a queue object on which threads can wait for entries.

VOID
  KeInitializeQueue(
    IN PKQUEUE  Queue,
    IN ULONG  Count  OPTIONAL
    ); 

Parameters

Queue
Pointer to a KQUEUE structure for which the caller must provide resident storage in nonpaged pool. This structure is defined as follows:

typedef struct _KQUEUE {
    DISPATCHER_HEADER Header;
    LIST_ENTRY EntryListHead;
    ULONG CurrentCount;
    ULONG MaximumCount;
    LIST_ENTRY ThreadListHead;
} KQUEUE, *PKQUEUE, *RESTRICTED_POINTER PRKQUEUE;

MemberMeaning
HeaderQueue header
EntryListHeadPointer to the first entry in the queue
CurrentCountNumber of entries in the queue
MaximumCountMaximum number of entries the queue can contain
ThreadListHeadPointer to the first entry in the thread list

Count
The maximum number of threads for which the waits on the queue object can be satisfied concurrently. If this parameter is not supplied, the number of processors in the machine is used.

Return Value

None

Comments

Usually the caller of KeInitializeQueue also creates a set of dedicated threads to queue and dequeue its entries. Such a caller can specify an explicit Count to prevent too many of its dedicated threads from waiting concurrently on its queue object.

KeInitializeQueue sets the queue object's initial signal state to Not Signaled.

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

Requirements

IRQL: <= DISPATCH_LEVEL

Headers: Declared in ntifs.h. Include ntifs.h.

See Also

ExAllocatePoolWithTag, IoAllocateWorkItem, IoQueueWorkItem, KeInsertQueue, KeRemoveQueue, KeRundownQueue, PsCreateSystemThread


Send feedback on this topic
Built on November 23, 2009
Page view tracker