Thread System 0.3.1
High-performance C++20 thread pool with work stealing and DAG scheduling
Loading...
Searching...
No Matches
forward.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
21#include <cstdint>
22
23namespace kcenon::thread {
24
25// ============================================================================
26// Core types
27// ============================================================================
28
30class thread_pool;
32struct thread_pool_config;
34class thread_worker;
36class thread_base;
38class job;
40class job_queue;
42class cancellation_token;
43
44// ============================================================================
45// Typed thread pool types
46// ============================================================================
47
49enum class job_types : uint8_t;
50
52template<typename JobType>
53class typed_thread_pool_t;
54
56template<typename JobType>
57class typed_thread_worker_t;
58
60template<typename JobType>
61class typed_job_t;
62
64template<typename JobType>
65class callback_typed_job_t;
66
68template<typename JobType>
69class typed_job_interface;
70
71// ============================================================================
72// Builder and policy types
73// ============================================================================
74
76class thread_pool_builder;
78class pool_factory;
80struct worker_policy;
82enum class scheduling_policy;
84enum class worker_state;
85
86// ============================================================================
87// Pool policy types
88// ============================================================================
89
91class pool_policy;
93class circuit_breaker_policy;
94
96template<typename JobType>
97class typed_thread_pool_builder;
98
99// ============================================================================
100// Scaling and resilience types
101// ============================================================================
102
103// circuit_breaker and circuit_breaker_config live in kcenon::common::resilience
104// and are imported via using declarations in headers that need them
106class autoscaler;
108struct autoscaling_policy;
110class numa_work_stealer;
112class pool_queue_adapter_interface;
113
114// ============================================================================
115// Queue types
116// ============================================================================
117
119class adaptive_job_queue;
120
121// ============================================================================
122// Policy types (in policies sub-namespace)
123// ============================================================================
124
125namespace policies {
126 // Sync policies
127 class mutex_sync_policy;
130
131 // Bound policies
132 class unbounded_policy;
133 class bounded_policy;
135
136 // Overflow policies
142} // namespace policies
143
145template<typename SyncPolicy, typename BoundPolicy, typename OverflowPolicy>
146class policy_queue;
147
148// ============================================================================
149// Internal implementation types (detail namespace)
150// ============================================================================
151
152namespace detail {
153 class lockfree_job_queue;
154
155 template<typename T>
157} // namespace detail
158
159// ============================================================================
160// Metrics types (in metrics sub-namespace)
161// ============================================================================
162
163namespace metrics {
164 class MetricsBase;
165 class ThreadPoolMetrics;
166 class EnhancedThreadPoolMetrics;
167 class MetricsBackend;
168 class PrometheusBackend;
169 class JsonBackend;
170 class LoggingBackend;
171 class BackendRegistry;
172 struct BaseSnapshot;
173 struct EnhancedSnapshot;
174 struct WorkerMetrics;
175} // namespace metrics
176
177// ============================================================================
178// Diagnostics types (in diagnostics sub-namespace)
179// ============================================================================
180
181namespace diagnostics {
182 class thread_pool_diagnostics;
183 struct job_info;
184 struct thread_info;
185 struct health_status;
186 struct component_health;
187 struct bottleneck_report;
188 struct job_execution_event;
189 struct diagnostics_config;
190 class execution_event_listener;
191
192 enum class job_status;
193 enum class worker_state;
194 enum class health_state;
195 enum class bottleneck_type;
196 enum class event_type;
197} // namespace diagnostics
198
199// ============================================================================
200// Synchronization primitives (in sync sub-namespace)
201// ============================================================================
202
203namespace sync {
204 template<typename Mutex>
206}
207
208// ============================================================================
209// Async operation types (C++20 only)
210// ============================================================================
211
212#if __cplusplus >= 202002L && __has_include(<coroutine>)
213template<typename T>
214class task;
215
216template<typename T>
217class awaitable;
218#endif
219
220} // namespace kcenon::thread
Thread-safe MPMC queue with blocking wait support (Internal implementation)
Definition forward.h:156
Adaptive synchronization policy that can switch modes.
Policy that limits queue size to a maximum.
Policy with dynamically adjustable size limit.
Lock-free synchronization policy using Michael-Scott algorithm.
Synchronization policy using mutex and condition variable.
Policy that blocks until space is available.
Policy that rejects new item when queue is full (same as reject)
Policy that drops the oldest item when queue is full.
Policy that rejects new items when queue is full.
Policy that blocks for a limited time when queue is full.
Policy that allows unlimited queue size.
Policy-based queue template.
RAII-based scoped lock guard with timeout support.
Definition forward.h:205
job_status
Status of a job in the thread pool.
Definition job_info.h:33
worker_state
Current state of a worker thread.
Definition thread_info.h:35
health_state
Overall health state of a component or system.
bottleneck_type
Type of bottleneck detected in the thread pool.
event_type
Type of job execution event.
Core threading foundation of the thread system library.
Definition thread_impl.h:17
worker_state
Enumeration of worker states.
job_types
Defines different types of jobs for a typed thread pool.
Definition job_types.h:33
scheduling_policy
Enumeration of scheduling policies.
Information about a job for starvation callback.