Class star::ThreadPool¶
ClassList > star > ThreadPool
Simple thread pool for parallel block operations. More...
#include <stards.h>
Public Functions¶
| Type | Name |
|---|---|
| ThreadPool (size_t num_threads=0) Construct thread pool. |
|
| ThreadPool (const ThreadPool &) = delete |
|
| ThreadPool (ThreadPool &&) = delete |
|
| std::future< void > | enqueue (Func && f) Enqueue a task for execution. |
| ThreadPool & | operator= (const ThreadPool &) = delete |
| ThreadPool & | operator= (ThreadPool &&) = delete |
| void | parallel_for (size_t start, size_t end, Func && func) Execute function in parallel for range [start, end). |
| size_t | size () const Get number of worker threads. |
| ~ThreadPool () Destructor - stops all worker threads. |
Detailed Description¶
Provides work-stealing task execution for parallel compression/decompression. Thread-safe and exception-safe.
Public Functions Documentation¶
function ThreadPool [1/3]¶
Construct thread pool.
Parameters:
num_threadsNumber of worker threads (0 = auto-detect)
function ThreadPool [2/3]¶
function ThreadPool [3/3]¶
function enqueue¶
Enqueue a task for execution.
Parameters:
fFunction to execute
Returns:
Future for result
function operator=¶
function operator=¶
function parallel_for¶
Execute function in parallel for range [start, end).
template<typename Func>
inline void star::ThreadPool::parallel_for (
size_t start,
size_t end,
Func && func
)
Parameters:
startStart index (inclusive)endEnd index (exclusive)funcFunction to execute for each index
function size¶
Get number of worker threads.
function ~ThreadPool¶
Destructor - stops all worker threads.
The documentation for this class was generated from the following file StarDS/include/stards.h