Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

MFLockSharedWorkQueue function

Obtains and locks a shared work queue.

Syntax


HRESULT MFLockSharedWorkQueue(
  _In_     PCWSTR wszClass,
  _In_     LONG BasePriority,
  _Inout_  DWORD *pdwTaskId,
  _Out_    DWORD *pID
);

Parameters

wszClass [in]

The name of the MMCSS task.

BasePriority [in]

The base priority of the work-queue threads. If the regular-priority queue is being used (wszClass=""), then the value 0 must be passed in.

pdwTaskId [in, out]

The MMCSS task identifier. On input, specify an existing MCCSS task group ID , or use the value zero to create a new task group. If the regular priority queue is being used (wszClass=""), then NULL must be passed in. On output, receives the actual task group ID.

pID [out]

Receives an identifier for the new work queue. Use this identifier when queuing work items.

Return value

If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

A multithreaded work queue uses a thread pool to dispatch work items. Whenever a thread becomes available, it dequeues the next work item from the queue. Work items are dequeued in first-in-first-out order, but work items are not serialized. In other words, the work queue does not wait for a work item to complete before it starts the next work item.

Within a single process, the Microsoft Media Foundation platform creates up to one multithreaded queue for each Multimedia Class Scheduler Service (MMCSS) task. The MFLockSharedWorkQueue function checks whether a matching work queue already exists. If not, the function creates a new work queue and registers the work queue with MMCSS. The function returns the MMCSS task identifier (pdwTaskId) and the work queue identifier (pID). To queue a work item, pass the work queue identifier to any of the following functions:

The MFLockSharedWorkQueue function also locks the queue. Before the process exits, call MFUnlockWorkQueue to unlock the work queue.

If the regular priority queue is being used (wszClass=""), then NULL must be passed in to pdwTaskId and the value 0 must be passed into BasePriority.

Windows Phone 8.1: This API is supported.

Requirements

Minimum supported client

Windows 8 [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2012 [desktop apps | Windows Store apps]

Header

Mfapi.h

Library

Mfplat.lib

DLL

Mfplat.dll

See also

Work Queues
Work Queue and Threading Improvements

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.