Parallel iterator that runs jobs with a given number of threads. More...
#include <run-jobs.hpp>
Classes | |
class | Deleter |
A class to delete the master (running in parallel) More... | |
class | Master |
class | Worker |
The actual worker using a thread to run a job. More... | |
Public Member Functions | |
RunJobs (Jobs &j, unsigned int m) | |
Initialize with job iterator j and maximal number of threads m. | |
bool | run (RetType &r) |
Run next job and return true if succesful and assign r to its result. | |
bool | stopped (int &i, RetType &r) const |
Whether a job has thrown a JobStop exception with index i and result r. | |
~RunJobs (void) | |
Destructor. | |
Protected Attributes | |
Master * | master |
The actual master. | |
Parallel iterator that runs jobs with a given number of threads.
It takes an iterator over jobs as input and acts as an iterator over the jobs' results. The order of iteration is not kept. The iterator runs several jobs as defined by the input iterator in parallel using a maximal number of threads.
The iterator can be stopped creating new jobs if one of the running jobs throws an exception of type JobStop. In that case the result of the stopped job is defined by the default constructor of the return type RetType. Already running jobs are not stopped and deliver their results as usual.
Definition at line 76 of file run-jobs.hpp.
|
inline |
Initialize with job iterator j and maximal number of threads m.
Definition at line 347 of file run-jobs.hpp.
|
inline |
Destructor.
Definition at line 358 of file run-jobs.hpp.
|
inline |
Run next job and return true if succesful and assign r to its result.
Definition at line 352 of file run-jobs.hpp.
|
inline |
Whether a job has thrown a JobStop exception with index i and result r.
Definition at line 340 of file run-jobs.hpp.
|
protected |
The actual master.
Definition at line 148 of file run-jobs.hpp.