Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

task::get Method

Returns the result this task produced. If the task is not in a terminal state, a call to get will wait for the task to finish. This method does not return a value when called on a task with a result_type of void.

_ReturnType get() const;

void get() const;

The result of the task.

If the task is canceled, a call to get will throw a task_canceled exception. If the task encountered an different exception or an exception was propagated to it from an antecedent task, a call to get will throw that exception.

Important note Important

In a Windows Store app, do not call concurrency::task::wait or get (wait calls get) in code that runs on the STA. Otherwise, the runtime throws concurrency::invalid_operation because these methods block the current thread and can cause the app to become unresponsive. However, you can call the get method to receive the result of the antecedent task in a task-based continuation because the result is immediately available.

Header: ppltasks.h

Namespace: concurrency

© 2017 Microsoft