56 std::vector<char> buffers_;
57 std::atomic<size_t> next_worker_index_;
70 , buffer_size_{buffer_size}
71 , next_worker_index_{0}
73 TEC_ENTER(
"SocketThreadPool::SocketThreadPool");
90 return (
char*)buffers_.data() + ((idx %
num_threads_) * buffer_size_);
114 return next_worker_index_.fetch_add(1, std::memory_order_relaxed)
Specialized thread pool that maintains one pre-allocated fixed-size buffer per worker thread — intend...
Definition tec_socket_thread_pool.hpp:53
constexpr size_t get_buffer_size()
Returns the size (in bytes) of each per-thread buffer.
Definition tec_socket_thread_pool.hpp:97
char * get_buffer(size_t idx) const
Returns a pointer to the buffer belonging to the worker at index idx
Definition tec_socket_thread_pool.hpp:88
virtual ~SocketThreadPool()
Destructor – releases all per-thread buffers.
Definition tec_socket_thread_pool.hpp:124
SocketThreadPool(size_t buffer_size, size_t num_threads)
Constructs a socket-oriented thread pool with per-thread buffers.
Definition tec_socket_thread_pool.hpp:68
size_t get_next_worker_index()
Atomically selects the next worker index in round-robin fashion.
Definition tec_socket_thread_pool.hpp:113
Simple, non-stealing thread pool implementation using a single shared task queue.
Definition tec_thread_pool.hpp:53
size_t num_threads_
Number of worker threads in the pool (set during construction)
Definition tec_thread_pool.hpp:59
std::vector< std::thread > workers_
Container holding all worker std::thread objects.
Definition tec_thread_pool.hpp:60
#define TEC_ENTER(name)
Logs an entry message for a named context (e.g., function).
Definition tec_trace.hpp:211
Common definitions and utilities for the tec namespace.
Simple, non-stealing thread pool implementation using a single shared task queue.
Provides a thread-safe tracing utility for debugging in the tec namespace.