Skip to content

Latest commit

 

History

History
142 lines (94 loc) · 4.53 KB

nf-rxworkq-rxdispatchtoworkerthread.md

File metadata and controls

142 lines (94 loc) · 4.53 KB
UID title description old-location tech.root ms.date keywords ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames f1_keywords topic_type api_type api_location api_name
NF:rxworkq.RxDispatchToWorkerThread
RxDispatchToWorkerThread function (rxworkq.h)
RxDispatchToWorkerThread invokes a routine in the context of a worker thread. The memory for the WORK_QUEUE_ITEM is allocated by this routine.
ifsk\rxdispatchtoworkerthread.htm
ifsk
04/16/2018
RxDispatchToWorkerThread function
RxDispatchToWorkerThread, RxDispatchToWorkerThread routine [Installable File System Drivers], ifsk.rxdispatchtoworkerthread, rxref_4ac4f78d-fd07-4d80-a4db-8215322d6c89.xml, rxworkq/RxDispatchToWorkerThread
rxworkq.h
Rxworkq.h, Rxstruc.h, Ntifs.h
Desktop
<= APC_LEVEL
Windows
RxDispatchToWorkerThread
rxworkq/RxDispatchToWorkerThread
APIRef
kbSyntax
HeaderDef
rxworkq.h
RxDispatchToWorkerThread

RxDispatchToWorkerThread function

-description

RxDispatchToWorkerThread invokes a routine in the context of a worker thread. The memory for the WORK_QUEUE_ITEM is allocated by this routine.

-parameters

-param pMRxDeviceObject [in]

A pointer to the device object of the corresponding network mini-redirector driver.

-param WorkQueueType [in]

The type of the work queue representing the priority of the task. The WorkQueueType parameter can be one of can be one of the following enumerations for WORK_QUEUE_TYPE:

CriticalWorkQueue

Insert the WORK_QUEUE_ITEM into the queue from which a system thread with a real-time priority attribute will process the work item.

DelayedWorkQueue

Insert the WORK_QUEUE_ITEM into the queue from which a system thread with a variable priority attribute will process the work item.

HyperCriticalWorkQueue

Insert the WORK_QUEUE_ITEM into the queue from which a system thread will process the work item so that the routine to be invoked is not blocked.

-param Routine [in]

A pointer to the routine to be invoked.

-param pContext [in]

A pointer to a context parameter associated with the work item to complete that is passed to the driver.

-returns

RxDispatchToWorkerThread returns STATUS_SUCCESS on success or one of the following error codes on failure:

Return code Description
STATUS_INSUFFICIENT_RESOURCES
The item could not be dispatched.

-remarks

There are two common cases of dispatching operations to worker threads:

  • For a very infrequent operation, space can be conserved by dynamically allocating and freeing memory for the work queue item when its is needed. The RxDispatchToWorkerThread routine would be used in this case
  • When an operation is going to be repeatedly dispatched, time is conserved by allocating in advance the WORK_QUEUE_ITEM as part of the data structure to be dispatched and using this pre-allocated memory repeatedly. The RxPostToWorkerThread routine would be used in this case
The trade off between the two dispatching operations is time versus space (memory usage).

The RxDispatchToWorkerThread invokes a routine in the context of a worker thread. The memory for the WORK_QUEUE_ITEM is allocated by the RxDispatchToWorkerThread routine from non-paged pool memory. Hence this routine can fail if insufficient resources are available.

The current implementation of the RxDispatchToWorkerThread routine queues work onto the same processor from which the call originated.

If the RxDispatchToWorkerThread routine fails on a debug build, the _RxLog routine is called with details of the error. If the RxDispatchToWorkerThread routine fails and WMI is enabled in the kernel, details of the error will be logged with WMI.

-see-also

RxPostToWorkerThread

RxSpinDownMRxDispatcher