KsRegisterCountedWorker function (ks.h)

Handles clients registering for use of a thread.

Syntax

KSDDKAPI NTSTATUS KsRegisterCountedWorker(
  [in]  WORK_QUEUE_TYPE  WorkQueueType,
  [in]  PWORK_QUEUE_ITEM CountedWorkItem,
  [out] PKSWORKER        *Worker
);

Parameters

[in] WorkQueueType

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

[in] CountedWorkItem

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

[out] 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

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