A type-erased execution context.
More...
#include <AnyExecutionContext.hpp>
|
| template<NotSameAs< AnyExecutionContext > CtxType> |
| | AnyExecutionContext (CtxType &ctx) |
| | Construct a new type-erased Execution Context object.
|
| template<RValueNotSameAs< AnyExecutionContext > CtxType> |
| | AnyExecutionContext (CtxType &&ctx) |
| | Construct a new type-erased Execution Context object.
|
|
| AnyExecutionContext (AnyExecutionContext const &)=default |
|
| AnyExecutionContext (AnyExecutionContext &&)=default |
|
AnyExecutionContext & | operator= (AnyExecutionContext const &)=default |
|
AnyExecutionContext & | operator= (AnyExecutionContext &&)=default |
| auto | execute (SomeHandlerWithoutStopToken auto &&fn) |
| | Execute a function on the execution context.
|
| auto | execute (SomeHandlerWith< AnyStopToken > auto &&fn) |
| | Execute a function on the execution context.
|
| auto | execute (SomeHandlerWith< AnyStopToken > auto &&fn, SomeStdDuration auto timeout) |
| | Execute a function with a timeout.
|
| auto | scheduleAfter (SomeStdDuration auto delay, SomeHandlerWith< AnyStopToken > auto &&fn) |
| | Schedule a function for execution.
|
| auto | scheduleAfter (SomeStdDuration auto delay, SomeHandlerWith< AnyStopToken, bool > auto &&fn) |
| | Schedule a function for execution.
|
| auto | executeRepeatedly (SomeStdDuration auto interval, SomeHandlerWithoutStopToken auto &&fn) |
| | Schedule a repeating operation on the execution context.
|
| void | submit (SomeHandlerWithoutStopToken auto &&fn) |
| | Schedule an operation on the execution context without expectations of a result.
|
| auto | makeStrand () |
| | Make a strand for this execution context.
|
|
void | stop () const |
| | Stop the execution context.
|
|
void | join () const |
| | Join the execution context.
|
A type-erased execution context.
◆ AnyExecutionContext() [1/2]
template<NotSameAs< AnyExecutionContext > CtxType>
| util::async::AnyExecutionContext::AnyExecutionContext |
( |
CtxType & | ctx | ) |
|
|
inline |
Construct a new type-erased Execution Context object.
- Note
- Stores the Execution Context by reference.
- Template Parameters
-
| CtxType | The type of the execution context to wrap |
- Parameters
-
| ctx | The execution context to wrap |
◆ AnyExecutionContext() [2/2]
template<RValueNotSameAs< AnyExecutionContext > CtxType>
| util::async::AnyExecutionContext::AnyExecutionContext |
( |
CtxType && | ctx | ) |
|
|
inline |
Construct a new type-erased Execution Context object.
- Note
- Stores the Execution Context by moving it into the AnyExecutionContext.
- Template Parameters
-
| CtxType | The type of the execution context to wrap |
- Parameters
-
| ctx | The execution context to wrap |
◆ execute() [1/3]
| auto util::async::AnyExecutionContext::execute |
( |
SomeHandlerWith< AnyStopToken > auto && | fn | ) |
|
|
inlinenodiscard |
Execute a function on the execution context.
- Parameters
-
| fn | The function to execute |
- Returns
- A stoppable operation that can be used to wait for the result
- Note
- The function is expected to take a stop token
◆ execute() [2/3]
| auto util::async::AnyExecutionContext::execute |
( |
SomeHandlerWith< AnyStopToken > auto && | fn, |
|
|
SomeStdDuration auto | timeout ) |
|
inlinenodiscard |
Execute a function with a timeout.
- Parameters
-
| fn | The function to execute |
| timeout | The timeout after which the function should be cancelled |
- Returns
- A stoppable operation that can be used to wait for the result
- Note
- The function is expected to take a stop token
◆ execute() [3/3]
| auto util::async::AnyExecutionContext::execute |
( |
SomeHandlerWithoutStopToken auto && | fn | ) |
|
|
inlinenodiscard |
Execute a function on the execution context.
- Parameters
-
| fn | The function to execute |
- Returns
- A unstoppable operation that can be used to wait for the result
◆ executeRepeatedly()
| auto util::async::AnyExecutionContext::executeRepeatedly |
( |
SomeStdDuration auto | interval, |
|
|
SomeHandlerWithoutStopToken auto && | fn ) |
|
inlinenodiscard |
Schedule a repeating operation on the execution context.
- Parameters
-
| interval | The interval at which the operation should be repeated |
| fn | The block of code to execute; no args allowed and return type must be void |
- Returns
- A repeating stoppable operation that can be used to wait for its cancellation
◆ makeStrand()
| auto util::async::AnyExecutionContext::makeStrand |
( |
| ) |
|
|
inlinenodiscard |
Make a strand for this execution context.
- Returns
- A strand for this execution context
- Note
- The strand can be used similarly to the execution context and guarantees serial execution of all submitted operations
◆ scheduleAfter() [1/2]
| auto util::async::AnyExecutionContext::scheduleAfter |
( |
SomeStdDuration auto | delay, |
|
|
SomeHandlerWith< AnyStopToken > auto && | fn ) |
|
inlinenodiscard |
Schedule a function for execution.
- Parameters
-
| delay | The delay after which the function should be executed |
| fn | The function to execute |
- Returns
- A stoppable operation that can be used to wait for the result
- Note
- The function is expected to take a stop token
◆ scheduleAfter() [2/2]
| auto util::async::AnyExecutionContext::scheduleAfter |
( |
SomeStdDuration auto | delay, |
|
|
SomeHandlerWith< AnyStopToken, bool > auto && | fn ) |
|
inlinenodiscard |
Schedule a function for execution.
- Parameters
-
| delay | The delay after which the function should be executed |
| fn | The function to execute |
- Returns
- A stoppable operation that can be used to wait for the result
- Note
- The function is expected to take a stop token and a boolean representing whether the scheduled operation got cancelled
◆ submit()
| void util::async::AnyExecutionContext::submit |
( |
SomeHandlerWithoutStopToken auto && | fn | ) |
|
|
inline |
Schedule an operation on the execution context without expectations of a result.
- Note
- Exceptions are caught internally and ASSERTed on
- Parameters
-
| fn | The block of code to execute |
The documentation for this class was generated from the following file: