120 [[nodiscard]]
auto get_name() const ->
std::
string override;
126 [[nodiscard]] auto
is_enabled() const ->
bool override;
Represents an error in the thread system.
Represents a unit of work (task) to be executed, typically by a job queue.
Base interface for thread pool policies.
Pool policy that implements work-stealing behavior for load balancing.
std::atomic< std::uint64_t > failed_steals_
void set_enabled(bool enabled) override
Enables or disables the policy.
work_stealing_pool_policy & operator=(work_stealing_pool_policy &&)=delete
void set_steal_backoff(std::chrono::microseconds backoff)
Sets the steal backoff duration.
work_stealing_pool_policy(work_stealing_pool_policy &&)=delete
void set_steal_policy(steal_policy policy)
Sets the steal policy (victim selection strategy).
void set_max_steal_attempts(std::size_t attempts)
Sets the maximum steal attempts per steal cycle.
void set_policy(const worker_policy &config)
Updates the worker policy configuration.
void record_failed_steal()
Records a failed steal attempt.
std::atomic< bool > enabled_
void reset_stats()
Resets the steal statistics.
~work_stealing_pool_policy() override=default
Destructor.
auto get_steal_backoff() const -> std::chrono::microseconds
Gets the steal backoff duration.
auto get_successful_steals() const -> std::uint64_t
Gets the total number of successful steals.
auto is_enabled() const -> bool override
Checks if the policy is enabled.
auto get_steal_policy() const -> steal_policy
Gets the steal policy (victim selection strategy).
auto get_policy() const -> const worker_policy &
Gets the current worker policy configuration.
void on_job_complete(job &j, bool success, const std::exception *error=nullptr) override
Called when a job completes.
auto on_enqueue(job &j) -> common::VoidResult override
Called before a job is enqueued.
auto get_name() const -> std::string override
Gets the policy name.
work_stealing_pool_policy(const worker_policy &config={})
Constructs a work-stealing policy with the given configuration.
void record_successful_steal()
Records a successful steal operation.
std::atomic< std::uint64_t > successful_steals_
work_stealing_pool_policy & operator=(const work_stealing_pool_policy &)=delete
work_stealing_pool_policy(const work_stealing_pool_policy &)=delete
void on_job_start(job &j) override
Called when job starts executing.
auto get_failed_steals() const -> std::uint64_t
Gets the total number of failed steal attempts.
auto get_max_steal_attempts() const -> std::size_t
Gets the maximum steal attempts per steal cycle.
Core threading foundation of the thread system library.
steal_policy
Policy for selecting steal victims.
Base interface for extensible thread pool behavior policies.
Worker behavior policy configuration.
Worker behavior policies and configuration.