Skip to main content
CoreDispatcher.RunIdleAsync method

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


public IAsyncAction RunIdleAsync(
  IdleDispatchedHandler agileCallback

Public Function RunIdleAsync(
  agileCallback As IdleDispatchedHandler 
) As IAsyncAction

IAsyncAction^ RunIdleAsync(
  IdleDispatchedHandler^ 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.


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 (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0


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



Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8


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



See also