WORK_QUEUE_ITEM structure (wdm.h)

The WORK_QUEUE_ITEM structure is used to post a work items to a system work queue.

Warning

Use this structure with extreme caution. See the following Remarks section.

Syntax

typedef struct _WORK_QUEUE_ITEM {
  LIST_ENTRY             List;
  PWORKER_THREAD_ROUTINE WorkerRoutine;
  __volatile PVOID       Parameter;
} WORK_QUEUE_ITEM, *PWORK_QUEUE_ITEM;

Members

List

Doubly linked list structure. This structure is used to add the work item to the system work queue.

WorkerRoutine

Pointer to a callback routine that processes this work item when the work item is dequeued. This callback routine is declared as follows:

VOID
(*PWORKER_THREAD_ROUTINE)(
    IN PVOID Parameter
    );

Parameter

Context information pointer specified in the Parameter member.

Parameter

Pointer to context information to be passed to the callback routine specified in the WorkerRoutine member.

Remarks

To initialize a WORK_QUEUE_ITEM structure, call ExInitializeWorkItem.

To post the initialized work item to a system work queue, call ExQueueWorkItem.

ExInitializeWorkItem and ExQueueWorkItem can only be used in cases where the specified work item is not associated with any device object or device stack. In all other cases, drivers should use IoAllocateWorkItem, IoFreeWorkItem, and IoQueueWorkItem, because only these routines ensure that the device object associated with the specified work item remains available until the work item has been processed.

Requirements

Requirement Value
Header wdm.h (include Wdm.h, Ntddk.h, Ntifs.h, Fltkernel.h)

See also

ExInitializeWorkItem

ExQueueWorkItem

IoAllocateWorkItem

IoFreeWorkItem

IoQueueWorkItem