Asynchronous engine primitives. More...
Namespaces | |
namespace | io |
Low-level asynchronous I/O interfaces. | |
Classes | |
class | ConditionVariable |
std::condition_variable replacement for asynchronous tasks More... | |
class | Deadline |
Internal representation of a deadline time point. More... | |
class | Future |
std::future replacement for asynchronous tasks that works in pair with engine::Promise More... | |
class | Mutex |
std::mutex replacement for asynchronous tasks More... | |
class | Promise |
std::promise replacement for asynchronous tasks that works in pair with engine::Future More... | |
class | Promise< void > |
class | Semaphore |
Class that allows up to max_simultaneous_locks concurrent accesses to the critical section. More... | |
class | SemaphoreLock |
A replacement for std::shared_lock that accepts Deadline arguments. More... | |
class | SharedMutex |
std::shared_mutex replacement for asynchronous tasks More... | |
class | SharedTaskWithResult |
class | SingleConsumerEvent |
A multiple-producers, single-consumer event. More... | |
class | SingleThreadedTaskProcessorsPool |
class | SingleUseEvent |
A single-producer, single-consumer event. More... | |
class | SingleWaitingTaskMutex |
Lighter version of Mutex with not more than 1 waiting task. More... | |
class | Task |
Asynchronous task. More... | |
class | TaskCancellationBlocker |
class | TaskCancellationToken |
Cancellation token to given task object. More... | |
class | TaskCancelledException |
Thrown if a TaskWithResult , for which we were waiting, got cancelled. More... | |
class | TaskInheritedVariable |
TaskInheritedVariable is a per-coroutine variable of arbitrary type. More... | |
class | TaskLocalVariable |
TaskLocalVariable is a per-coroutine variable of arbitrary type. More... | |
struct | TaskProcessorPoolsConfig |
A lightweight TaskProcessor config for engine::RunStandalone. More... | |
class | TaskWithResult |
class | UnreachableSemaphoreLockError |
class | WaitInterruptedException |
Typedefs | |
template<typename T > | |
using | MpscQueue = concurrent::MpscQueue< T > |
Enumerations | |
enum class | CvStatus { kNoTimeout , kTimeout , kCancelled } |
std::condition_variable state extended with "cancelled" state More... | |
enum class | FutureStatus { kReady , kTimeout , kCancelled } |
std::future state extended with "cancelled" state More... | |
enum class | TaskCancellationReason { kNone , kUserRequest , kDeadline , kOverload , kAbandoned , kShutdown } |
Task cancellation reason. More... | |
Functions | |
template<typename Function , typename... Args> | |
auto | AsyncNoSpan (TaskProcessor &task_processor, Function &&f, Args &&... args) |
Runs an asynchronous function call using specified task processor. | |
template<typename Function , typename... Args> | |
auto | SharedAsyncNoSpan (TaskProcessor &task_processor, Function &&f, Args &&... args) |
Runs an asynchronous function call using specified task processor. | |
template<typename Function , typename... Args> | |
auto | AsyncNoSpan (TaskProcessor &task_processor, Deadline deadline, Function &&f, Args &&... args) |
template<typename Function , typename... Args> | |
auto | SharedAsyncNoSpan (TaskProcessor &task_processor, Deadline deadline, Function &&f, Args &&... args) |
template<typename Function , typename... Args> | |
auto | AsyncNoSpan (Function &&f, Args &&... args) |
Runs an asynchronous function call using task processor of the caller. | |
template<typename Function , typename... Args> | |
auto | SharedAsyncNoSpan (Function &&f, Args &&... args) |
Runs an asynchronous function call using task processor of the caller. | |
template<typename Function , typename... Args> | |
auto | AsyncNoSpan (Deadline deadline, Function &&f, Args &&... args) |
template<typename Function , typename... Args> | |
auto | SharedAsyncNoSpan (Deadline deadline, Function &&f, Args &&... args) |
template<typename Function , typename... Args> | |
auto | CriticalAsyncNoSpan (TaskProcessor &task_processor, Function &&f, Args &&... args) |
Runs an asynchronous function call that will start regardless of cancellations using specified task processor. | |
template<typename Function , typename... Args> | |
auto | SharedCriticalAsyncNoSpan (TaskProcessor &task_processor, Function &&f, Args &&... args) |
Runs an asynchronous function call that will start regardless of cancellations using specified task processor. | |
template<typename Function , typename... Args> | |
auto | CriticalAsyncNoSpan (Function &&f, Args &&... args) |
Runs an asynchronous function call that will start regardless of cancellations using task processor of the caller. | |
template<typename Function , typename... Args> | |
auto | SharedCriticalAsyncNoSpan (Function &&f, Args &&... args) |
Runs an asynchronous function call that will start regardless of cancellations using task processor of the caller. | |
template<typename Function , typename... Args> | |
auto | CriticalAsyncNoSpan (Deadline deadline, Function &&f, Args &&... args) |
Runs an asynchronous function call that will start regardless of cancellations, using task processor of the caller, with deadline. | |
template<typename... Tasks> | |
auto | GetAll (Tasks &... tasks) |
Waits for the successful completion of all of the specified tasks or the cancellation of the caller. | |
void | RunStandalone (std::function< void()> payload) |
Runs a payload in a temporary coroutine engine instance. | |
void | RunStandalone (std::size_t worker_threads, std::function< void()> payload) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | RunStandalone (std::size_t worker_threads, const TaskProcessorPoolsConfig &config, std::function< void()> payload) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | Yield () |
Suspends execution for a brief period of time, possibly allowing other tasks to execute. | |
template<typename Rep , typename Period > | |
void | InterruptibleSleepFor (const std::chrono::duration< Rep, Period > &duration) |
template<typename Clock , typename Duration > | |
void | InterruptibleSleepUntil (const std::chrono::time_point< Clock, Duration > &time_point) |
template<typename Rep , typename Period > | |
void | SleepFor (const std::chrono::duration< Rep, Period > &duration) |
Suspends execution for at least a specified amount of time. | |
template<typename Clock , typename Duration > | |
void | SleepUntil (const std::chrono::time_point< Clock, Duration > &time_point) |
Suspends execution until the specified time point is reached. | |
std::string | ToString (TaskCancellationReason reason) |
Returns a string representation of a cancellation reason. | |
template<typename... Tasks> | |
void | WaitAllChecked (Tasks &... tasks) |
Waits for the successful completion of all of the specified tasks or for the cancellation of the caller. | |
template<typename... Tasks, typename Rep , typename Period > | |
FutureStatus | WaitAllCheckedFor (const std::chrono::duration< Rep, Period > &duration, Tasks &... tasks) |
template<typename... Tasks, typename Clock , typename Duration > | |
FutureStatus | WaitAllCheckedUntil (const std::chrono::time_point< Clock, Duration > &until, Tasks &... tasks) |
template<typename... Tasks> | |
FutureStatus | WaitAllCheckedUntil (Deadline deadline, Tasks &... tasks) |
template<typename... Tasks> | |
std::optional< std::size_t > | WaitAny (Tasks &... tasks) |
Waits for the completion of any of the specified tasks or the cancellation of the caller. | |
template<typename... Tasks, typename Rep , typename Period > | |
std::optional< std::size_t > | WaitAnyFor (const std::chrono::duration< Rep, Period > &duration, Tasks &... tasks) |
template<typename... Tasks, typename Clock , typename Duration > | |
std::optional< std::size_t > | WaitAnyUntil (const std::chrono::time_point< Clock, Duration > &until, Tasks &... tasks) |
template<typename... Tasks> | |
std::optional< std::size_t > | WaitAnyUntil (Deadline, Tasks &... tasks) |
Asynchronous engine primitives.
using engine::MpscQueue = typedef concurrent::MpscQueue<T> |
Definition at line 9 of file mpsc_queue.hpp.
|
strong |
std::condition_variable state extended with "cancelled" state
Definition at line 11 of file condition_variable_status.hpp.
|
strong |
std::future state extended with "cancelled" state
Enumerator | |
---|---|
kReady | the future is ready |
kTimeout | the wait operation timed out |
kCancelled | the wait operation was interrupted by task cancellation |
Definition at line 11 of file future_status.hpp.
|
strong |
auto engine::AsyncNoSpan | ( | Deadline | deadline, |
Function && | f, | ||
Args &&... | args | ||
) |
auto engine::AsyncNoSpan | ( | Function && | f, |
Args &&... | args | ||
) |
auto engine::AsyncNoSpan | ( | TaskProcessor & | task_processor, |
Deadline | deadline, | ||
Function && | f, | ||
Args &&... | args | ||
) |
auto engine::AsyncNoSpan | ( | TaskProcessor & | task_processor, |
Function && | f, | ||
Args &&... | args | ||
) |
Runs an asynchronous function call using specified task processor.
auto engine::CriticalAsyncNoSpan | ( | Deadline | deadline, |
Function && | f, | ||
Args &&... | args | ||
) |
auto engine::CriticalAsyncNoSpan | ( | Function && | f, |
Args &&... | args | ||
) |
auto engine::CriticalAsyncNoSpan | ( | TaskProcessor & | task_processor, |
Function && | f, | ||
Args &&... | args | ||
) |
void engine::InterruptibleSleepFor | ( | const std::chrono::duration< Rep, Period > & | duration | ) |
void engine::InterruptibleSleepUntil | ( | const std::chrono::time_point< Clock, Duration > & | time_point | ) |
void engine::RunStandalone | ( | std::function< void()> | payload | ) |
Runs a payload in a temporary coroutine engine instance.
Creates a TaskProcessor with specified parameters, executes the payload in an Async and exits. Mainly designated for async code unit testing.
payload | Code to be run in a Task |
worker_threads | Engine thread pool size, 1 by default |
config | A lightweight TaskProcessor config |
auto engine::SharedAsyncNoSpan | ( | Deadline | deadline, |
Function && | f, | ||
Args &&... | args | ||
) |
auto engine::SharedAsyncNoSpan | ( | Function && | f, |
Args &&... | args | ||
) |
auto engine::SharedAsyncNoSpan | ( | TaskProcessor & | task_processor, |
Deadline | deadline, | ||
Function && | f, | ||
Args &&... | args | ||
) |
auto engine::SharedAsyncNoSpan | ( | TaskProcessor & | task_processor, |
Function && | f, | ||
Args &&... | args | ||
) |
auto engine::SharedCriticalAsyncNoSpan | ( | Function && | f, |
Args &&... | args | ||
) |
auto engine::SharedCriticalAsyncNoSpan | ( | TaskProcessor & | task_processor, |
Function && | f, | ||
Args &&... | args | ||
) |
void engine::SleepFor | ( | const std::chrono::duration< Rep, Period > & | duration | ) |
void engine::SleepUntil | ( | const std::chrono::time_point< Clock, Duration > & | time_point | ) |
FutureStatus engine::WaitAllCheckedFor | ( | const std::chrono::duration< Rep, Period > & | duration, |
Tasks &... | tasks | ||
) |
Definition at line 106 of file wait_all_checked.hpp.
FutureStatus engine::WaitAllCheckedUntil | ( | const std::chrono::time_point< Clock, Duration > & | until, |
Tasks &... | tasks | ||
) |
Definition at line 112 of file wait_all_checked.hpp.
FutureStatus engine::WaitAllCheckedUntil | ( | Deadline | deadline, |
Tasks &... | tasks | ||
) |
Definition at line 118 of file wait_all_checked.hpp.
std::optional< std::size_t > engine::WaitAnyFor | ( | const std::chrono::duration< Rep, Period > & | duration, |
Tasks &... | tasks | ||
) |
Definition at line 61 of file wait_any.hpp.
std::optional< std::size_t > engine::WaitAnyUntil | ( | const std::chrono::time_point< Clock, Duration > & | until, |
Tasks &... | tasks | ||
) |
Definition at line 67 of file wait_any.hpp.
std::optional< std::size_t > engine::WaitAnyUntil | ( | Deadline | deadline, |
Tasks &... | tasks | ||
) |
Definition at line 105 of file wait_any.hpp.