ModErn Text Analysis
META Enumerates Textual Applications
Classes | Functions
meta::parallel Namespace Reference

Implementation of a thread pool and a parallel for loop. More...

Classes

class  thread_pool
 Represents a collection of a fixed number of threads, which tasks can be added to. More...
 

Functions

template<class Iterator , class Function >
void parallel_for (Iterator begin, Iterator end, Function func)
 Runs the given function on the range denoted by begin and end in parallel. More...
 
template<class Iterator , class Function >
void parallel_for (Iterator begin, Iterator end, thread_pool &pool, Function func)
 Runs the given function on the range denoted by begin and end in parallel. More...
 

Detailed Description

Implementation of a thread pool and a parallel for loop.

Function Documentation

template<class Iterator , class Function >
void meta::parallel::parallel_for ( Iterator  begin,
Iterator  end,
Function  func 
)

Runs the given function on the range denoted by begin and end in parallel.

Parameters
beginThe first element to operate on
endOne past the last element to operate on
funcThe function to perform on each element
template<class Iterator , class Function >
void meta::parallel::parallel_for ( Iterator  begin,
Iterator  end,
thread_pool pool,
Function  func 
)

Runs the given function on the range denoted by begin and end in parallel.

Parameters
beginThe first element to operate on
endOne past the last element to operate on
poolThe thread pool to use
funcThe function to perform on each element