C++ Rest SDK
The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services.
Public Member Functions | Friends | List of all members
pplx::task_completion_event< void > Class Template Reference

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. More...

#include <pplxtasks.h>

Public Member Functions

bool set () const
 Sets the task completion event. More...
 
template<typename _E >
 __declspec (noinline) bool set_exception(_E _Except) const
 
 __declspec (noinline) bool set_exception(std
 Propagates an exception to all tasks associated with this event. More...
 
void _Cancel () const
 Cancel the task_completion_event. Any task created using this event will be marked as canceled if it has not already been set. More...
 
void _Cancel (const std::shared_ptr< details::_ExceptionHolder > &_ExHolder) const
 Cancel the task_completion_event with the exception holder provided. Any task created using this event will be canceled with the same exception. More...
 
bool _StoreException (const std::shared_ptr< details::_ExceptionHolder > &_ExHolder) const
 Method that stores an exception in the task completion event. This is used internally by when_any. Note, this does not cancel the task completion event. A task completion event with a stored exception can bet set() successfully. If it is canceled, it will cancel with the stored exception, if one is present. More...
 
bool _IsTriggered () const
 Test whether current event has been either Set, or Canceled. More...
 

Friends

template<typename T >
class task
 

Detailed Description

template<>
class pplx::task_completion_event< void >

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.

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.

See also
task Class

Member Function Documentation

pplx::task_completion_event< void >::__declspec ( noinline  )
inline

Propagates an exception to all tasks associated with this event.

The exception_ptr that indicates the exception to set this event with.

void pplx::task_completion_event< void >::_Cancel ( ) const
inline

Cancel the task_completion_event. Any task created using this event will be marked as canceled if it has not already been set.

void pplx::task_completion_event< void >::_Cancel ( const std::shared_ptr< details::_ExceptionHolder > &  _ExHolder) const
inline

Cancel the task_completion_event with the exception holder provided. Any task created using this event will be canceled with the same exception.

bool pplx::task_completion_event< void >::_IsTriggered ( ) const
inline

Test whether current event has been either Set, or Canceled.

bool pplx::task_completion_event< void >::_StoreException ( const std::shared_ptr< details::_ExceptionHolder > &  _ExHolder) const
inline

Method that stores an exception in the task completion event. This is used internally by when_any. Note, this does not cancel the task completion event. A task completion event with a stored exception can bet set() successfully. If it is canceled, it will cancel with the stored exception, if one is present.

bool pplx::task_completion_event< void >::set ( ) const
inline

Sets the task completion event.

Returns
The method returns true if it was successful in setting the event. It returns false if the event is already set.

In the presence of multiple or concurrent calls to set, only the first call will succeed and its result (if any) will be stored in the task completion event. The remaining sets are ignored and the method will return false. When you set a task completion event, all the tasks created from that event will immediately complete, and its continuations, if any, will be scheduled. Task completion objects that have a _ResultType other than void will pass the value to their continuations.


The documentation for this class was generated from the following file: