Upravit

Sdílet prostřednictvím


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.

Syntax

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

inline auto resume_foreground(
    Windows::System::DispatcherQueue const& dispatcher,
    Windows::System::DispatcherQueuePriority const priority = Windows::System::DispatcherQueuePriority::Normal) noexcept;

inline auto resume_foreground(
    Microsoft::System::DispatcherQueue const& dispatcher,
    Microsoft::System::DispatcherQueuePriority const priority = Microsoft::System::DispatcherQueuePriority::Normal) noexcept;

Parameters

dispatcher A winrt::Windows::UI::Core::CoreDispatcher (or winrt::Windows::System::DispatcherQueue or winrt::Microsoft::System::DispatcherQueue) whose foreground thread to switch execution to.

priority Specifies the priority for event dispatch.

Return value

An object that you can co_await.

Requirements

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), %WindowsSdkDir%Include<WindowsTargetPlatformVersion>\cppwinrt\winrt\Windows.System.h (not included by default), $(ProjectDir)Generated Files\winrt\Microsoft.System.h (not included by default)

See also