|
olp-cpp-sdk
1.23.1
|
Handles the cancellation and final mechanisms. More...
#include <ExecutionContext.h>
Public Member Functions | |
| ExecutionContext () | |
A default contructor, initializes the ExecutionContextImpl instance. | |
| bool | Cancelled () const |
Checks whether CancellationContext is cancelled. More... | |
| void | CancelOperation () |
| void | ExecuteOrCancelled (const ExecuteFuncType &execute_fn, const CancelFuncType &cancel_fn=nullptr) |
| void | SetError (client::ApiError error) |
Sets the error that is returned in the Finally method of the execution. More... | |
| void | SetFailedCallback (FailedCallback callback) |
Sets a callback for SetError. More... | |
| const client::CancellationContext & | GetContext () const |
Gets the CancellationContext object associated with this ExecutionContext instance. More... | |
Handles the cancellation and final mechanisms.
| bool olp::thread::ExecutionContext::Cancelled | ( | ) | const |
Checks whether CancellationContext is cancelled.
CancellationContext is cancelled; false otherwise. | void olp::thread::ExecutionContext::CancelOperation | ( | ) |
| void olp::thread::ExecutionContext::ExecuteOrCancelled | ( | const ExecuteFuncType & | execute_fn, |
| const CancelFuncType & | cancel_fn = nullptr |
||
| ) |
| const client::CancellationContext& olp::thread::ExecutionContext::GetContext | ( | ) | const |
Gets the CancellationContext object associated with this ExecutionContext instance.
The caller can use it to cancel the ongoing operation.
CancellationContext instance. | void olp::thread::ExecutionContext::SetError | ( | client::ApiError | error | ) |
Sets the error that is returned in the Finally method of the execution.
It immediately finishes the task execution and provides an error via the SetFailedCallback callback of ExecutionContext.
| error | The ApiError instance containing the error information. |
| void olp::thread::ExecutionContext::SetFailedCallback | ( | FailedCallback | callback | ) |
Sets a callback for SetError.
| callback | Handles the finalization of the execution in case of an error. |