KsRegisterCountedWorker function

Handles clients registering for use of a thread.


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



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


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


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.


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.


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