KsRegisterCountedWorker function

Handles clients registering for use of a thread.

Syntax

KSDDKAPI NTSTATUS KsRegisterCountedWorker(
  WORK_QUEUE_TYPE  WorkQueueType,
  PWORK_QUEUE_ITEM CountedWorkItem,
  PKSWORKER        *Worker
);

Parameters

WorkQueueType

Contains the priority of the work thread. This is normally one of the following: CriticalWorkQueue, DelayedWorkQueue, or HyperCriticalWorkQueue.

CountedWorkItem

Contains a pointer to the work queue item that will be queued as needed based on the current count value.

Worker

Contains the opaque context that must be used when scheduling a work item. Also contains the queue type, and is used to synchronize completion of work items.

Return Value

Returns STATUS_SUCCESS if a worker was initialized.

Remarks

This must be matched by a corresponding KsUnregisterWorker when thread use is completed. This function resembles KsRegisterWorker, with the addition of passing the work item that will always be queued. This is to be used with KsIncrementCountedWorker and KsDecrementCountedWorker in order to minimize the number of work items queued, and reduce mutual exclusion code necessary in a work item needed to serialize access against multiple work item threads. The worker queue can still be used to queue other work items. This may only be called at PASSIVE_LEVEL.

Requirements

   
Target Platform Universal
Header ks.h (include Ks.h)
Library Ks.lib