Template Struct Worker¶
Defined in File quickpool.hxx
Struct Documentation¶
-
template<typename Function>
struct quickpool::loop::Worker¶
-
Worker class for parallel loops.
When a worker completes its own range, it steals half of the remaining range of another worker. The number of steals (= only source of contention) is therefore only logarithmic in the number of tasks. The algorithm uses double-width compare-and-swap, which is lock-free on most modern processor architectures.
- tparam type
-
of function processing the loop (required to account for type-erasure).
Public Functions
-
inline Worker()¶
-
inline size_t tasks_left() const¶
-
inline bool done() const¶
-
- Parameters
-
others – pointer to the vector of all workers.
-
inline void steal_range(mem::aligned::vector<Worker> &workers)¶
-
- Parameters
-
workers – vector of all workers.