Thread System 0.3.1
High-performance C++20 thread pool with work stealing and DAG scheduling
Loading...
Searching...
No Matches
config.h
Go to the documentation of this file.
1#pragma once
2
3// BSD 3-Clause License
4// Copyright (c) 2024, 🍀☀🌕🌥 🌊
5// See the LICENSE file in the project root for full license information.
6
15#include "job_types.h"
16#include <cstddef>
17
18namespace kcenon::thread::config {
19
20 // Default type settings
22
23 // Performance configuration
24 constexpr size_t default_queue_size = 1024;
25 constexpr size_t default_worker_count = 4;
26 constexpr size_t max_workers = 64;
27 constexpr size_t min_workers = 1;
28
29 // Queue behavior settings
30 constexpr size_t default_wait_timeout_ms = 100;
31 constexpr size_t default_shutdown_timeout_ms = 5000;
32
33 // Feature flags
34 constexpr bool enable_statistics = true;
35 constexpr bool enable_priority_boost = false;
36 constexpr bool enable_work_stealing = true;
37 constexpr bool enable_adaptive_sizing = false;
38
39 // Memory management
40 constexpr size_t default_job_pool_size = 512;
41 constexpr bool enable_job_recycling = true;
42
43 // Debugging and monitoring
44 constexpr bool enable_debug_logging = false;
45 constexpr bool enable_performance_monitoring = false;
46 constexpr size_t monitoring_interval_ms = 1000;
47
51 static_assert(default_queue_size > 0, "Queue size must be positive");
52 static_assert(default_worker_count >= min_workers, "Worker count must be at least minimum");
53 static_assert(default_worker_count <= max_workers, "Worker count must not exceed maximum");
54 static_assert(default_wait_timeout_ms > 0, "Wait timeout must be positive");
55 static_assert(default_shutdown_timeout_ms > 0, "Shutdown timeout must be positive");
56
57} // namespace kcenon::thread::config
Job type definitions for the typed thread pool.
constexpr bool enable_performance_monitoring
Definition config.h:45
constexpr size_t default_shutdown_timeout_ms
Definition config.h:31
constexpr bool enable_job_recycling
Definition config.h:41
constexpr bool enable_adaptive_sizing
Definition config.h:37
constexpr bool enable_work_stealing
Definition config.h:36
constexpr size_t default_queue_size
Definition config.h:26
constexpr bool enable_debug_logging
Definition config.h:44
constexpr size_t default_wait_timeout_ms
Definition config.h:30
constexpr size_t default_job_pool_size
Definition config.h:40
constexpr bool enable_statistics
Definition config.h:85
constexpr size_t max_workers
Definition config.h:26
constexpr size_t monitoring_interval_ms
Definition config.h:46
constexpr size_t min_workers
Definition config.h:27
constexpr bool enable_priority_boost
Definition config.h:35
constexpr size_t default_worker_count
Definition config.h:25
job_types
Defines different types of jobs for a typed thread pool.
Definition job_types.h:33