15#include "forward_declarations.h"
30 template<detail::JobType job_type>
39 [[nodiscard]]
virtual job_type
type() const noexcept = 0;
45 [[nodiscard]] virtual common::VoidResult
execute() = 0;
57 [[nodiscard]] virtual
bool is_ready() const noexcept {
98 template<detail::JobType job_type>
104 template<detail::JobType job_type>
113 template<detail::JobType job_type>
125 template<detail::JobCallable F>
129 const std::string& description =
"callback_job"
Factory interface for creating typed jobs.
virtual ~typed_job_factory_interface()=default
virtual typed_job_ptr< job_type > create_job(job_type type, F &&callback, const std::string &description="callback_job")=0
Create a new job with the specified type and callback.
virtual void cleanup() noexcept
Release resources associated with completed jobs.
Typed job interface template.
virtual bool is_ready() const noexcept
Check if this job can be executed.
virtual bool is_cancelled() const noexcept
Check if this job has been cancelled.
virtual common::VoidResult execute()=0
Execute the job's work.
virtual job_type type() const noexcept=0
Get the type/priority of this job.
virtual bool has_higher_priority(const typed_job_interface &other) const noexcept
Check if this job has higher priority than another job.
virtual ~typed_job_interface()=default
virtual std::string description() const =0
Get a human-readable description of this job.
virtual uint64_t estimated_execution_time_us() const noexcept
Get the estimated execution time for this job.
virtual bool cancel() noexcept
Cancel this job if possible.
@ callback
Call user callback for custom decision.
Error codes and utilities for the thread system.
constexpr bool higher_priority(T lhs, T rhs) noexcept
Compile-time priority comparison.
Core threading foundation of the thread system library.
std::shared_ptr< typed_job_interface< job_type > > typed_job_ptr
Shared pointer type for typed job interfaces.
std::weak_ptr< typed_job_interface< job_type > > typed_job_weak_ptr
Weak pointer type for typed job interfaces.
Type traits for typed_thread_pool module.