Compartir a través de


task_completion_event Class (C++ REST SDK)

The task_completion_event class allows you to delay the execution of a task until a condition is satisfied, or start a task in response to an external event.

Warning

This topic contains information for the C++ REST SDK 1.0 (codename "Casablanca"). If you are using a later version from the Codeplex Casablanca web page, then use the local documentation at http://casablanca.codeplex.com/documentation.

template<
   typename _ResultType
>
class task_completion_event;

template<>
class task_completion_event<void>;

Parameters

  • _ResultType
    The result type of this task_completion_event class.

  • T

Members

Public Constructors

Name

Description

task_completion_event::task_completion_event Constructor (C++ REST SDK)

Constructs a task_completion_event object.

Public Methods

Name

Description

task_completion_event::set Method (C++ REST SDK)

Overloaded. Sets the task completion event.

task_completion_event::set_exception Method (C++ REST SDK)

Overloaded. Propagates an exception to all tasks associated with this event.

Remarks

Use a task created from a task completion event when your scenario requires you to create a task that will complete, and thereby have its continuations scheduled for execution, at some point in the future. The task_completion_event must have the same type as the task you create, and calling the set method on the task completion event with a value of that type will cause the associated task to complete, and provide that value as a result to its continuations.

If the task completion event is never signaled, any tasks created from it will be canceled when it is destructed.

task_completion_event behaves like a smart pointer, and should be passed by value.

Requirements

Header: pplxtasks.h

Namespace: pplx

See Also

Reference

pplx Namespace

task Class