Gecode::Support::RunJobs< Jobs, RetType > Class Template Reference
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. |
Detailed Description
template<class Jobs, class RetType>
class Gecode::Support::RunJobs< Jobs, RetType >
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 78 of file run-jobs.hpp.
Constructor & Destructor Documentation
Gecode::Support::RunJobs< Jobs, RetType >::RunJobs | ( | Jobs & | j, | |
unsigned int | m | |||
) | [inline] |
Initialize with job iterator j and maximal number of threads m.
Definition at line 349 of file run-jobs.hpp.
Gecode::Support::RunJobs< Jobs, RetType >::~RunJobs | ( | void | ) | [inline] |
Destructor.
Definition at line 360 of file run-jobs.hpp.
Member Function Documentation
bool Gecode::Support::RunJobs< Jobs, RetType >::run | ( | RetType & | r | ) | [inline] |
Run next job and return true if succesful and assign r to its result.
Definition at line 354 of file run-jobs.hpp.
bool Gecode::Support::RunJobs< Jobs, RetType >::stopped | ( | int & | i, | |
RetType & | r | |||
) | const [inline] |
Whether a job has thrown a JobStop exception with index i and result r.
Definition at line 342 of file run-jobs.hpp.
Member Data Documentation
Master* Gecode::Support::RunJobs< Jobs, RetType >::master [protected] |
The actual master.
Definition at line 150 of file run-jobs.hpp.
The documentation for this class was generated from the following file:
- gecode/support/run-jobs.hpp (Revision: 15372)