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.
|
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 | |
task_completion_event () | |
Constructs a task_completion_event object. More... | |
bool | set (_ResultType _Result) 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... | |
bool | _Cancel () const |
Internal method to cancel the task_completion_event. Any task created using this event will be marked as canceled if it has not already been set. More... | |
template<typename _ExHolderType > | |
bool | _Cancel (_ExHolderType _ExHolder, const details::_TaskCreationCallstack &_SetExceptionAddressHint=details::_TaskCreationCallstack()) const |
Internal method to cancel the task_completion_event with the exception provided. Any task created using this event will be canceled with the same exception. More... | |
template<typename _ExHolderType > | |
bool | _StoreException (_ExHolderType _ExHolder, const details::_TaskCreationCallstack &_SetExceptionAddressHint=details::_TaskCreationCallstack()) const |
Internal 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 |
Tests whether current event has been either Set, or Canceled. More... | |
Friends | |
template<typename T > | |
class | task |
template<typename T > | |
class | task_completion_event |
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.
_ResultType | The result type of this task_completion_event class. |
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.
|
inline |
Constructs a task_completion_event
object.
|
inline |
Propagates an exception to all tasks associated with this event.
The exception_ptr that indicates the exception to set this event with.
|
inline |
Internal method to cancel the task_completion_event. Any task created using this event will be marked as canceled if it has not already been set.
|
inline |
Internal method to cancel the task_completion_event with the exception provided. Any task created using this event will be canceled with the same exception.
|
inline |
Tests whether current event has been either Set, or Canceled.
|
inline |
Internal 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.
|
inline |
Sets the task completion event.
_Result | The result to set this event with. |
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.