pthreadpool
pthreadpool is a portable and efficient thread pool implementation.
It provides similar functionality to #pragma omp parallel for, but with additional features.
Features:
- C interface (C++-compatible).
- 1D-6D loops with step parameters.
- Run on user-specified or auto-detected number of threads.
- Work-stealing scheduling for efficient work balancing.
- Wait-free synchronization of work items.
- Compatible with Linux (including Android), macOS, iOS, Windows, Emscripten environments.
- 100% unit tests coverage.
- Throughput and latency microbenchmarks.
Example
The following example demonstates using the thread pool for parallel addition of two arrays: