Functions and constants functions
Free functions and constants of WinRT.
- Use
import ThinkMeta.ConcurrentTasks.WinRT.Await;- Namespace
ThinkMeta::ConcurrentTasks::WinRT
Functions
WinRT::Await
Waits for an asynchronous WinRT operation and returns its result.
Syntax
template <AsyncOperationType AsyncOp> auto Await(const AsyncOp& op);Template parameters
AsyncOpAsyncOperationType- The operation type, see
AsyncOperationType.
Parameters
opconst AsyncOp&- The started operation.
Return value
Type: auto
The result of GetResults; nothing for an action.
Remarks
Returns at once if the operation has finished, otherwise suspends the calling task until the operation completes; the scheduler thread runs other tasks meanwhile. Throws like co_await: GetResults throws winrt::hresult_error for a failed operation and winrt::hresult_canceled for a canceled one. Task or converted thread only. Sets the operation's Completed handler, which an operation accepts only once. The task may resume on another scheduler thread: use agile objects only (the WinRT default; not objects bound to a single-threaded apartment). Initialize the multithreaded apartment once for the process, e.g. winrt::init_apartment() on the main thread, so that the scheduler threads belong to it implicitly. There is no timed variant: a timed-out wait would leave the handler behind with a reference to the task's stack.
See also
Concepts
WinRT::AsyncOperationType
Matches the C++/WinRT asynchronous operation types.
Syntax
template <typename T> concept AsyncOperationType = requires(const T& op);Template parameters
Ttypename- The candidate type.
Remarks
Satisfied by IAsyncAction, IAsyncOperation<TResult>, IAsyncActionWithProgress<TProgress> and IAsyncOperationWithProgress<TResult, TProgress>, and by every type with the same Status, Completed and GetResults members.
See also
Generated from ThinkMeta.ConcurrentTasks.API @ e29892d (2026-10-30).