Class tpool_t¶
Defined in File tpool.hpp
Nested Relationships¶
Nested Types¶
Class Documentation¶
-
class tpool_t¶
Simple static thread pool. Optimized for the case of a few consumers that produce a lot of work, like a renderer.
Public Functions
-
inline tpool_t(std::size_t threads = native_concurrency)¶
Construct a new tpool_t with threads count of threads.
-
inline ~tpool_t()¶
-
inline auto thread_count() const noexcept¶
Get thread count in the thread pool.
-
inline const auto &get_threads() const noexcept¶
Returns the threads in the pool.
-
template<std::invocable F>
inline auto enqueue(F &&f) const noexcept¶ Enqueues a task and returns a future.
-
inline auto coro() const noexcept¶
-
template<std::default_initializable T>
inline auto create_worker_arena() const noexcept¶ Create a worker arena, each worker arena is default initialized T(). Each worker thread in this thread pool can access its local arena via tpool_worker_arena_t::get().
-
template<std::copy_constructible T>
inline auto create_worker_arena(const T &arena) const noexcept¶ Create a worker arena, each worker arena is copy constructed from `arena’. Each worker thread in this thread pool can access its local arena via tpool_worker_arena_t::get().
-
inline tpool_t(std::size_t threads = native_concurrency)¶