9#ifndef STLAB_CONCURRENCY_EXECUTOR_BASE_HPP
10#define STLAB_CONCURRENCY_EXECUTOR_BASE_HPP
22#include <stlab/execution/config.hpp>
33STLAB_EXECUTION_VERSION_NAMESPACE_BEGIN()
47template <typename Rep, typename Per = std::ratio<1>>
49 return [_duration = std::move(duration), _executor = std::move(
executor)](
auto f)
mutable {
50 if (_duration != std::chrono::duration<Rep, Per>{})
52 [_f = std::move(f), _executor]()
mutable noexcept {
53 _executor(std::move(_f));
56 _executor(std::move(f));
61[[deprecated(
"Use chrono::duration as parameter instead")]]
inline auto execute_at(
63 using namespace std::chrono;
64 return execute_at(duration_cast<nanoseconds>(when - steady_clock::now()), std::move(
executor));
68template <
typename E,
typename Rep,
typename Per = std::ratio<1>>
99STLAB_EXECUTION_VERSION_NAMESPACE_END()
std::function< void(stlab::task< void() noexcept >)> executor_t
Type-erased executor: accepts a void() noexcept task.
Definition executor_base.hpp:44
auto execute_delayed(std::chrono::duration< Rep, Per > duration, E executor)
Returns an executor that delays each submitted task by duration before forwarding to executor.
Definition executor_base.hpp:69
auto execute_at(std::chrono::duration< Rep, Per > duration, executor_t executor) -> executor_t
Returns an executor that posts tasks to executor after duration (immediate if zero).
Definition executor_base.hpp:48
constexpr auto system_timer
Schedules move-only void() noexcept tasks through the process-shared timer service.
Definition system_timer.hpp:233
typename noexcept_deducer< task_, F >::type task
task_ with noexcept deduced from the function type F (e.g. void() vs void() noexcept).
Definition task.hpp:453
Definition default_executor.hpp:49
Executor plus callable, produced by executor & f (used by futures and channels).
Definition executor_base.hpp:80
Wraps an executor_t for use with operator&.
Definition executor_base.hpp:74
Asynchronous delayed execution through the process-shared timer service.
Move-only callable wrapper for executor scheduling (task<Signature>).