VOID
ExQueueWorkItem(
IN PWORK_QUEUE_ITEM WorkItem,
IN WORK_QUEUE_TYPE QueueType
);
ExQueueWorkItem inserts a given work item into a queue from which a system worker thread removes the item and gives control to the routine that the caller supplied to ExInitializeWorkItem.
Parameters
WorkItem
Points to the work item that was set up by a preceding call to ExInitializeWorkItem.
QueueType
Specifies the queue into which WorkItem is inserted. QueueType can be either of the following:
Value | Meaning |
CriticalWorkQueue | Insert the WorkItem into the queue from which a system thread with a real-time priority attribute will dequeue the entry. |
DelayedWorkQueue | Insert the WorkItem into the queue from which a system thread with a variable priority attribute will dequeue the entry. |
The QueueType value HyperCriticalWorkQueue is reserved for system use.
Comments
Highest-level drivers can call ExQueueWorkItem.
The callback is run within a system thread context at IRQL PASSIVE_LEVEL. This caller-supplied routine is responsible for calling ExFreePool to reclaim the storage allocated for WorkItem.
A driver must not wait for its callback routine to complete an operation if it is already holding one synchronization object and might attempt to acquire another. For example, a driver should release any currently held semaphores, mutexes, resource variables, and so forth before it calls ExQueueWorkItem. Releasing synchronization resources before queueing a synchronous worker-thread operation prevents deadlocks.
The value of QueueType determines the runtime priority at which the callback routine is run, as follows:
·If the callback runs in the system thread with a real-time priority attribute, the callback routine cannot be preempted except by threads with higher real-time priorities.
·If the callback runs in the system thread with a variable priority attribute, the callback can be preempted by threads with higher variable and real-time priorities, and the callback is scheduled to run round-robin with other threads of the same priority for a quantum each.
Threads at either priority remain interruptible.
Callers of ExQueueWorkItem must be running at IRQL <= DISPATCH_LEVEL.
See Also