|
ThreadSchedule 3.0.0
Modern C++ thread management library
|
Scheduler that executes delayed and periodic tasks on worker threads. More...
#include <scheduled_pool.hpp>
Public Member Functions | |
| scheduled_pool () | |
| Construct with default scheduler configuration. | |
| scheduled_pool (worker_count count) | |
| Construct with explicit worker count. | |
| scheduled_pool (scheduled_pool_config config) | |
| Construct from full configuration. | |
| scheduled_pool (scheduled_pool &&other) noexcept | |
| auto | operator= (scheduled_pool &&other) noexcept -> scheduled_pool & |
| scheduled_pool (scheduled_pool const &)=delete | |
| auto | operator= (scheduled_pool const &) -> scheduled_pool &=delete |
| ~scheduled_pool () | |
| Shutdown scheduler and workers according to configured policy. | |
| template<typename Rep , typename Period , typename F > | |
| auto | schedule_after (std::chrono::duration< Rep, Period > delay, F &&function) -> result< scheduled_task > |
| Schedule a one-shot task to run after a delay. | |
| template<typename F > | |
| auto | schedule_at (std::chrono::steady_clock::time_point time, F &&function) -> result< scheduled_task > |
| Schedule a one-shot task at an absolute time point. | |
| template<typename Rep , typename Period , typename F > | |
| auto | schedule_periodic (std::chrono::duration< Rep, Period > interval, F &&function) -> result< scheduled_task > |
| Schedule a periodic task. | |
| template<typename InitialRep , typename InitialPeriod , typename IntervalRep , typename IntervalPeriod , typename F > | |
| auto | schedule_periodic_after (std::chrono::duration< InitialRep, InitialPeriod > initial_delay, std::chrono::duration< IntervalRep, IntervalPeriod > interval, F &&function) -> result< scheduled_task > |
| Schedule a periodic task with initial delay. | |
| auto | shutdown () -> result< void > |
| Shutdown using configured shutdown policy. | |
| auto | shutdown (shutdown_policy policy) -> result< void > |
| Shutdown with explicit policy. | |
| auto | scheduled_count () const -> std::size_t |
| Return count of tasks currently tracked by the scheduler backend. | |
Static Public Member Functions | |
| static auto | create (scheduled_pool_config config={}) -> result< scheduled_pool > |
| Create a scheduled pool without exceptions. | |
Scheduler that executes delayed and periodic tasks on worker threads.
Definition at line 129 of file scheduled_pool.hpp.
|
inline |
Construct with default scheduler configuration.
Definition at line 133 of file scheduled_pool.hpp.
|
inlineexplicit |
Construct with explicit worker count.
| count | Number of worker threads or automatic resolution mode. |
Definition at line 139 of file scheduled_pool.hpp.
|
inlineexplicit |
Construct from full configuration.
| config | Scheduler configuration. |
| std::system_error | if worker/scheduler thread configuration fails. |
Definition at line 146 of file scheduled_pool.hpp.
References threadschedule::scheduled_pool_config::get_scheduler_config(), threadschedule::scheduled_pool_config::get_worker_config(), threadschedule::detail::has_thread_configuration(), and threadschedule::detail::to_native().
|
inlinenoexcept |
Definition at line 166 of file scheduled_pool.hpp.
|
delete |
|
inline |
Shutdown scheduler and workers according to configured policy.
Definition at line 192 of file scheduled_pool.hpp.
|
inlinestatic |
Create a scheduled pool without exceptions.
| config | Scheduler configuration. |
Definition at line 203 of file scheduled_pool.hpp.
|
inlinenoexcept |
Definition at line 174 of file scheduled_pool.hpp.
|
delete |
|
inline |
Schedule a one-shot task to run after a delay.
| delay | Relative delay before first execution. |
| function | Callable to execute. |
Definition at line 216 of file scheduled_pool.hpp.
References threadschedule::detail::try_result().
|
inline |
Schedule a one-shot task at an absolute time point.
| time | Absolute steady_clock timestamp. |
| function | Callable to execute. |
Definition at line 240 of file scheduled_pool.hpp.
References threadschedule::detail::try_result().
|
inline |
Schedule a periodic task.
| interval | Execution interval; must be > 0. |
| function | Callable to execute each tick. |
errc::invalid_argument for non-positive interval. Definition at line 262 of file scheduled_pool.hpp.
References threadschedule::detail::try_result().
|
inline |
Schedule a periodic task with initial delay.
| initial_delay | Delay before first execution. |
| interval | Period between executions; must be > 0. |
| function | Callable to execute. |
Definition at line 289 of file scheduled_pool.hpp.
References threadschedule::detail::try_result().
|
inline |
Return count of tasks currently tracked by the scheduler backend.
Definition at line 341 of file scheduled_pool.hpp.
|
inline |
Shutdown using configured shutdown policy.
Definition at line 316 of file scheduled_pool.hpp.
References threadschedule::scheduled_pool_config::get_shutdown_policy(), and shutdown().
Referenced by shutdown().
|
inline |
Shutdown with explicit policy.
| policy | Drain/cancel behavior for pending tasks. |
Definition at line 326 of file scheduled_pool.hpp.
References threadschedule::detail::to_native(), and threadschedule::detail::try_result().