|
using | ContextHolderType = ContextType |
|
using | ExecutorType = typename ContextHolderType::Executor |
|
template<typename T > |
using | ValueType = std::expected<T, ExecutionError> |
|
using | StopSource = StopSourceType |
|
using | StopToken = typename StopSourceType::Token |
|
template<typename T > |
using | StoppableOperation = StoppableOperation<ValueType<T>, StopSourceType> |
|
template<typename T > |
using | Operation = Operation<ValueType<T>> |
|
using | Strand |
|
using | Timer = typename ContextHolderType::Timer |
|
template<typename T > |
using | ScheduledOperation = ScheduledOperation<BasicExecutionContext, StoppableOperation<T>> |
|
using | RepeatedOperation = RepeatingOperation<BasicExecutionContext> |
|
|
| BasicExecutionContext (std::size_t numThreads=1) noexcept |
| Create a new execution context with the given number of threads.
|
|
| ~BasicExecutionContext () |
| Stops the underlying thread pool.
|
|
| BasicExecutionContext (BasicExecutionContext &&)=default |
|
| BasicExecutionContext (BasicExecutionContext const &)=delete |
|
auto | scheduleAfter (SomeStdDuration auto delay, SomeHandlerWith< StopToken > auto &&fn, std::optional< std::chrono::milliseconds > timeout=std::nullopt) noexcept(kIS_NOEXCEPT) |
| Schedule an operation on the execution context.
|
|
auto | scheduleAfter (SomeStdDuration auto delay, SomeHandlerWith< StopToken, bool > auto &&fn, std::optional< std::chrono::milliseconds > timeout=std::nullopt) noexcept(kIS_NOEXCEPT) |
| Schedule an operation on the execution context.
|
|
auto | executeRepeatedly (SomeStdDuration auto interval, SomeHandlerWithoutStopToken auto &&fn) noexcept(kIS_NOEXCEPT) |
| Schedule a repeating operation on the execution context.
|
|
auto | execute (SomeHandlerWith< StopToken > auto &&fn, std::optional< std::chrono::milliseconds > timeout=std::nullopt) noexcept(kIS_NOEXCEPT) |
| Schedule an operation on the execution context.
|
|
auto | execute (SomeHandlerWith< StopToken > auto &&fn, SomeStdDuration auto timeout) noexcept(kIS_NOEXCEPT) |
| Schedule an operation on the execution context.
|
|
auto | execute (SomeHandlerWithoutStopToken auto &&fn) noexcept(kIS_NOEXCEPT) |
| Schedule an operation on the execution context.
|
|
Strand | makeStrand () |
| Create a strand for this execution context.
|
|
void | stop () const noexcept |
| Stop the execution context as soon as possible.
|
|
void | join () const noexcept |
| Block until all operations are completed.
|
|
template<typename ContextType, typename StopSourceType, typename DispatcherType, typename TimerContextProvider = impl::SelfContextProvider, typename ErrorHandlerType = impl::DefaultErrorHandler>
class util::async::BasicExecutionContext< ContextType, StopSourceType, DispatcherType, TimerContextProvider, ErrorHandlerType >
A highly configurable execution context.
This execution context is used as the base for all specialized execution contexts. Return values are handled by capturing them and returning them packaged as std::expected. Exceptions may or may not be caught and handled depending on the error strategy. The default behavior is to catch and package them as the error channel of std::expected.