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

A helper function—for use within a coroutine—that returns control to the caller, and then resumes execution on a thread pool thread after a delay.

For more info, see Concurrency and asynchronous operations.

Syntax

inline auto resume_after(winrt::Windows::Foundation::TimeSpan duration) noexcept;

Parameters

duration

The duration of the delay.

Return value

An object that you can co_await.

Remarks

You can use the functions and operators in the std::chrono and std::literals::chrono_literals namespaces to create TimeSpan values conveniently.

co_await winrt::resume_after(std::chrono::milliseconds(250));
using namespace std::literals::chrono_literals;
co_await winrt::resume_after(250ms);

Requirements

Minimum supported SDK: Windows SDK version 10.0.17134.0 (Windows 10, version 1803)

Namespace: winrt

Header: %WindowsSdkDir%Include<WindowsTargetPlatformVersion>\cppwinrt\winrt\base.h (included by default)

See also