Export (0) Print
Expand All
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

CoreDispatcher.RunIdleAsync method

Applies to Windows and Windows Phone

Schedules a callback on the UI thread from a worker thread at idle priority, and returns the results asynchronously.

Syntax


public IAsyncAction RunIdleAsync(
  IdleDispatchedHandler agileCallback
)

Parameters

agileCallback

Type: IdleDispatchedHandler

The callback on which the idle priority dispatcher returns when the event is dispatched.

Return value

Type: IAsyncAction

Object that contains the results of the asynchronous action.

Remarks

The RunIdleAsync method is very similar to CoreDispatcher::RunAsync, except that it always schedules the work item at CoreDispatcherPriority::Low priority. When you schedule a work item by calling RunIdleAsync from a worker thread, the work item is processed only when there are no event messages pending in the queue. This allows your app to perform tasks such as spell check or other discrete processing while the system is idle. If the IdleDispatchedHandler delegate returned by the callback has the IsDispatcherIdle property set to false, the work item immediately exits background processing until the event queue is empty again.

However, while your app is processing a background task, it can continue processing as long as there are no event messages pending in the CoreDispatcher event message queue. If your app receives an event message in the queue, then it must break out of the background processing. To determine when your app must exit background processing, access the IsDispatcherIdle property on the IdleDispatchedHandlerArgs object returned by the IdleDispatchedHandler callback you provided to RunIdleAsync. If there is a message, exit background processing and set the priority to CoreDispatcherPriority::Normal. Otherwise, if the callback continues to run without checking the dispatcher status, it could lead to input starvation.

Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8

Namespace

Windows.UI.Core
Windows::UI::Core [C++]

Metadata

Windows.winmd

See also

CoreDispatcher::RunAsync
CoreDispatcher

 

 

Show:
© 2014 Microsoft