Thread System 0.3.1
High-performance C++20 thread pool with work stealing and DAG scheduling
Loading...
Searching...
No Matches
queue.cppm
Go to the documentation of this file.
1// BSD 3-Clause License
2// Copyright (c) 2025, 🍀☀🌕🌥 🌊
3// See the LICENSE file in the project root for full license information.
4
21module;
22
23// Standard library includes needed before module declaration
24#include <atomic>
25#include <chrono>
26#include <condition_variable>
27#include <deque>
28#include <functional>
29#include <memory>
30#include <mutex>
31#include <optional>
32#include <string>
33#include <string_view>
34#include <type_traits>
35#include <vector>
36
37// Include existing headers in the global module fragment
41
42// The legacy lockfree_queue.h re-exports concurrent_queue under the old
43// name for backward compatibility. Suppress its deprecation notice here
44// because the module itself is the authorized re-exporter.
45#define THREAD_SUPPRESS_LEGACY_LOCKFREE_QUEUE_WARNING 1
52
53export module kcenon.thread:queue;
54
55import kcenon.common;
56
57// ============================================================================
58// Queue Capabilities
59// ============================================================================
60
61export namespace kcenon::thread {
62
63// Re-export queue capability types
64using ::kcenon::thread::queue_capabilities;
65using ::kcenon::thread::queue_capabilities_interface;
66
67} // namespace kcenon::thread
68
69// ============================================================================
70// Standard Job Queue
71// ============================================================================
72
73export namespace kcenon::thread {
74
75// Re-export standard queue types
76using ::kcenon::thread::job_queue;
77
78} // namespace kcenon::thread
79
80// ============================================================================
81// Adaptive Queue
82// ============================================================================
83
84export namespace kcenon::thread {
85
86// Re-export adaptive queue types
87using ::kcenon::thread::adaptive_job_queue;
88
89} // namespace kcenon::thread
90
91// ============================================================================
92// Lock-Free Queue
93// ============================================================================
94
95export namespace kcenon::thread {
96
97// Re-export lock-free queue types
98using ::kcenon::thread::lockfree_queue;
99
100} // namespace kcenon::thread
101
102export namespace kcenon::thread::detail {
103
104// Re-export internal lock-free job queue
105using ::kcenon::thread::detail::lockfree_job_queue;
106
107} // namespace kcenon::thread::detail
108
109// ============================================================================
110// Work-Stealing Deque
111// ============================================================================
112
113export namespace kcenon::thread {
114
115// Re-export work-stealing types
116using ::kcenon::thread::work_stealing_deque;
117
118} // namespace kcenon::thread
119
120// ============================================================================
121// Queue Factory
122// ============================================================================
123
124export namespace kcenon::thread {
125
126// Re-export factory types
127using ::kcenon::thread::queue_factory;
128using ::kcenon::thread::queue_type;
129
130} // namespace kcenon::thread
131
132// ============================================================================
133// Concurrent Queue
134// ============================================================================
135
136export namespace kcenon::thread {
137
138// Re-export concurrent queue types
139using ::kcenon::thread::concurrent_queue;
140
141} // namespace kcenon::thread
Adaptive queue that auto-switches between mutex and lock-free modes.
Thread-safe MPMC queue with blocking wait support.
Thread-safe FIFO job queue with optional bounded size.
Lock-free MPMC job queue using Michael-Scott algorithm with hazard pointers.
Backward compatibility header for concurrent_queue.
Core threading foundation of the thread system library.
Definition thread_impl.h:17
Runtime-queryable queue capabilities descriptor.
Mixin interface for queue capability introspection.
Factory for creating queue instances based on configuration.
Dynamic circular array work-stealing deque for lock-free task distribution.