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

MFPutWaitingWorkItem function

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

Syntax


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

Parameters

hEvent [in]

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

Priority [in]

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

pResult [in]

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

pKey [out]

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

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

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:

  • The default work queue (MFASYNC_CALLBACK_QUEUE_STANDARD).
  • The platform multithreaded queue (MFASYNC_CALLBACK_QUEUE_MULTITHREADED).
  • A multithreaded queue returned by the MFLockSharedWorkQueue function.
  • A serial queue created by the MFAllocateSerialWorkQueue function.

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.

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;
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.