A type-erased execution context.
More...
#include <AnyExecutionContext.hpp>
A type-erased execution context.
◆ AnyExecutionContext() [1/2]
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]
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
The documentation for this class was generated from the following file: