9 template <
typename job_type>
12 std::function<common::VoidResult()> work,
13 const std::string& name)
15 , aged_priority_{
priority, 0,
std::chrono::steady_clock::now()}
16 , work_(
std::move(work))
20 template <
typename job_type>
23 template <
typename job_type>
33 template <
typename job_type>
37 return aged_priority_;
40 template <
typename job_type>
44 return aged_priority_;
47 template <
typename job_type>
50 aged_priority_.apply_boost(boost_amount, max_boost_);
53 template <
typename job_type>
56 aged_priority_.reset_boost();
59 template <
typename job_type>
65 template <
typename job_type>
71 template <
typename job_type>
77 template <
typename job_type>
80 return aged_priority_.effective_priority();
83 template <
typename job_type>
86 return aged_priority_.wait_time();
89 template <
typename job_type>
94 aged_priority_.wait_time(),
100 template class aging_typed_job_t<job_types>;
Typed job with priority aging support to prevent starvation.
auto get_aged_priority() const -> const aged_priority< job_type > &
Gets the aged priority information.
auto do_work() -> common::VoidResult override
Executes the job's work function.
auto effective_priority() const -> job_type
Gets the effective priority after applying boost.
auto set_max_boost(int max) -> void
Sets the maximum allowed boost.
auto to_job_info() const -> job_info
Creates job_info for starvation callbacks.
auto reset_boost() -> void
Resets the priority boost to zero.
auto is_max_boosted() const -> bool
Checks if this job has reached maximum boost.
aging_typed_job_t(job_type priority, std::function< common::VoidResult()> work, const std::string &name="aging_job")
Constructs a new aging typed job.
auto get_max_boost() const -> int
Gets the maximum allowed boost.
~aging_typed_job_t() override
Destroys the aging typed job.
auto apply_boost(int boost_amount) -> void
Applies a priority boost to this job.
auto wait_time() const -> std::chrono::milliseconds
Gets the time this job has been waiting.
Core threading foundation of the thread system library.
@ priority
Priority-based scheduling.
Priority with aging support.
auto is_max_boosted(int max_boost) const -> bool
Checks if this job has reached max boost.
Information about a job for starvation callback.