MFPutWaitingWorkItem

Queues a work item that waits for an event to be signaled.

Syntax

HRESULT MFPutWaitingWorkItem(
         HANDLE hEvent,
         LONG Priority,
         IMFAsyncResult *pResult,
         MFWORKITEM_KEY *pKey
)  

Parameters

hEvent
Type: HANDLE 

A handle to an event object. To create an event object, call CreateEvent or CreateEventEx.

Priority
Type: LONG 

The priority of the work item. Work items are performed in order of priority.

pResult
Type: IMFAsyncResult *

[in] A pointer to the IMFAsyncResult interface of an asynchronous result object. To create the result object, call MFCreateAsyncResult.

pKey
Type: MFWORKITEM_KEY *

[out, optional] Receives a key that can be used to cancel the wait. To cancel the wait, call MFCancelWorkItem and pass this key in the Key parameter. This parameter can be NULL.

Return value

Type: HRESULT 

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

Refer to Media Foundation return codes.

Remarks

This function enables a component to wait for an event without blocking the current thread.

The function puts a work item on the specified work queue. This work item waits for the event given in hEvent to be signaled. When the event is signaled, the work item invokes a callback. (The callback is contained in the result object given in pResult. For more information, see MFCreateAsyncResult).
The work item is dispatched on a work queue by the IMFAsyncCallback::GetParameters method of the callback. The work queue can be any of the following:

Do not use any of the following work queues: MFASYNC_CALLBACK_QUEUE_IO, MFASYNC_CALLBACK_QUEUE_LONG_FUNCTION, MFASYNC_CALLBACK_QUEUE_RT, or MFASYNC_CALLBACK_QUEUE_TIMER.

Requirements

Header: Declared in mfapi.h.

Library: Use mfplat.lib.