winrt::resume_foreground function (C++/WinRT)

A helper function—for use within a coroutine—that you can co_await to switch execution to a specific foreground thread. For more info, and a code example, see Programming with thread affinity in mind.


inline auto resume_foreground(
    Windows::UI::Core::CoreDispatcher const& dispatcher,
    Windows::UI::Core::CoreDispatcherPriority const priority = Windows::UI::Core::CoreDispatcherPriority::Normal) noexcept;


dispatcher A winrt::Windows::UI::Core::CoreDispatcher whose foreground thread to switch execution to.

priority Specifies the priority for event dispatch.

Return value

An object that you can co_await.


Minimum supported SDK: Windows SDK version 10.0.17763.0 (Windows 10, version 1809)

Namespace: winrt

Header %WindowsSdkDir%Include<WindowsTargetPlatformVersion>\cppwinrt\winrt\Windows.UI.Core.h (not included by default)

See also