20#include <kcenon/common/resilience/circuit_breaker_config.h>
121 std::unique_ptr<pool_queue_adapter_interface> adapter);
135 const circuit_breaker_config& config = {});
145 std::shared_ptr<circuit_breaker> cb);
221 [[nodiscard]] std::shared_ptr<thread_pool>
build();
Configuration for autoscaling behavior and thresholds.
Pool policy implementing automatic worker scaling based on load.
Pool policy implementing circuit breaker pattern for failure protection.
Context object that provides access to optional services.
Fluent builder for creating and configuring thread pools.
std::vector< std::unique_ptr< pool_policy > > policies_
std::shared_ptr< job_queue > custom_queue_
thread_pool_builder & with_work_stealing()
Enables work-stealing with default configuration.
std::optional< autoscaling_policy > autoscaling_config_
std::unique_ptr< pool_queue_adapter_interface > queue_adapter_
thread_pool_builder & with_policy(std::unique_ptr< pool_policy > policy)
Adds a custom policy to the pool.
thread_pool_builder & with_workers(std::size_t count)
Sets the number of worker threads.
thread_pool_builder & with_context(const thread_context &context)
Sets the thread context for logging and monitoring.
std::shared_ptr< thread_pool > build()
Builds and returns the configured thread pool.
std::size_t worker_count_
std::optional< worker_policy > work_stealing_config_
std::shared_ptr< thread_pool > build_and_start()
Builds the pool and starts it immediately.
std::shared_ptr< circuit_breaker > shared_circuit_breaker_
thread_pool_builder & with_queue_adapter(std::unique_ptr< pool_queue_adapter_interface > adapter)
Sets a policy-based queue adapter.
thread_pool_builder & with_diagnostics()
Enables diagnostics for the pool.
bool enable_enhanced_metrics_
thread_pool_builder & with_circuit_breaker(const circuit_breaker_config &config={})
Adds circuit breaker protection.
thread_pool_builder & with_queue(std::shared_ptr< job_queue > queue)
Sets a custom job queue.
std::optional< circuit_breaker_config > circuit_breaker_config_
thread_pool_builder & with_enhanced_metrics()
Enables enhanced metrics collection.
thread_pool_builder(const std::string &name="thread_pool")
Constructs a builder with the given pool name.
thread_pool_builder & with_autoscaling(const autoscaling_policy &config={})
Enables autoscaling with the specified policy.
Core thread pool implementation with work stealing and auto-scaling.
Core threading foundation of the thread system library.
Configuration for autoscaling behavior.
Worker behavior policy configuration.
Context object providing access to optional thread system services.
Pool policy implementing work-stealing for load balancing.
Worker behavior policies and configuration.