Gecode::Support::RunJobs< Jobs, RetType >::Master Class Reference
#include <run-jobs.hpp>
Public Member Functions | |
Job< RetType > * | next (int &i) |
Get next job witth index i, if possible. | |
void | report (RetType r) |
Report result r by a worker. | |
void | stop (RetType r, int i) |
Report that a job with index i has been stopped. | |
bool | done (void) const |
Test whether all jobs are done. | |
Master (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 (void) const |
Whether a job has thrown a JobStop exception. | |
int | stoppedjob (RetType &r) const |
Return index of first job that has thrown a JobStop exception (-1 if none) with its result. | |
bool | needthread (void) |
Whether a new thread is needed for deletion. | |
~Master (void) | |
Destructor. | |
Protected Attributes | |
Mutex | m |
Mutex for synchronizing access. | |
Event | e |
Event is triggered if a the first job is added to queue. | |
unsigned int | n_threads |
Number of threads currently not in use. | |
Jobs & | jobs |
Input jobs. | |
int | idx |
Index of next job to be created. | |
RetType | sres |
Result from a the first stopped job (passed in exception). | |
int | sidx |
Index of the first stop that has been stopped (-1 if none). | |
DynamicQueue< RetType, Heap > | rs |
Queue of not yet requested results. |
Detailed Description
template<class Jobs, class RetType>
class Gecode::Support::RunJobs< Jobs, RetType >::Master
Definition at line 96 of file run-jobs.hpp.
Constructor & Destructor Documentation
Gecode::Support::RunJobs< Jobs, RetType >::Master::Master | ( | Jobs & | j, | |
unsigned int | m | |||
) | [inline] |
Initialize with job iterator j and maximal number of threads m.
Definition at line 258 of file run-jobs.hpp.
Gecode::Support::RunJobs< Jobs, RetType >::Master::~Master | ( | void | ) | [inline] |
Destructor.
Definition at line 316 of file run-jobs.hpp.
Member Function Documentation
Job< RetType > * Gecode::Support::RunJobs< Jobs, RetType >::Master::next | ( | int & | i | ) | [inline] |
Get next job witth index i, if possible.
Definition at line 200 of file run-jobs.hpp.
void Gecode::Support::RunJobs< Jobs, RetType >::Master::report | ( | RetType | r | ) | [inline] |
Report result r by a worker.
Definition at line 216 of file run-jobs.hpp.
void Gecode::Support::RunJobs< Jobs, RetType >::Master::stop | ( | RetType | r, | |
int | i | |||
) | [inline] |
Report that a job with index i has been stopped.
Definition at line 225 of file run-jobs.hpp.
bool Gecode::Support::RunJobs< Jobs, RetType >::Master::done | ( | void | ) | const [inline] |
Test whether all jobs are done.
Definition at line 252 of file run-jobs.hpp.
bool Gecode::Support::RunJobs< Jobs, RetType >::Master::run | ( | RetType & | r | ) | [inline] |
Run next job and return true if succesful and assign r to its result.
Definition at line 272 of file run-jobs.hpp.
bool Gecode::Support::RunJobs< Jobs, RetType >::Master::stopped | ( | void | ) | const [inline] |
Whether a job has thrown a JobStop exception.
Definition at line 194 of file run-jobs.hpp.
int Gecode::Support::RunJobs< Jobs, RetType >::Master::stoppedjob | ( | RetType & | r | ) | const [inline] |
Return index of first job that has thrown a JobStop exception (-1 if none) with its result.
Definition at line 187 of file run-jobs.hpp.
bool Gecode::Support::RunJobs< Jobs, RetType >::Master::needthread | ( | void | ) | [inline] |
Whether a new thread is needed for deletion.
Definition at line 303 of file run-jobs.hpp.
Member Data Documentation
Mutex Gecode::Support::RunJobs< Jobs, RetType >::Master::m [protected] |
Mutex for synchronizing access.
Definition at line 99 of file run-jobs.hpp.
Event Gecode::Support::RunJobs< Jobs, RetType >::Master::e [protected] |
Event is triggered if a the first job is added to queue.
Definition at line 101 of file run-jobs.hpp.
unsigned int Gecode::Support::RunJobs< Jobs, RetType >::Master::n_threads [protected] |
Number of threads currently not in use.
Definition at line 103 of file run-jobs.hpp.
Jobs& Gecode::Support::RunJobs< Jobs, RetType >::Master::jobs [protected] |
Input jobs.
Definition at line 105 of file run-jobs.hpp.
int Gecode::Support::RunJobs< Jobs, RetType >::Master::idx [protected] |
Index of next job to be created.
Definition at line 107 of file run-jobs.hpp.
RetType Gecode::Support::RunJobs< Jobs, RetType >::Master::sres [protected] |
Result from a the first stopped job (passed in exception).
Definition at line 109 of file run-jobs.hpp.
int Gecode::Support::RunJobs< Jobs, RetType >::Master::sidx [protected] |
Index of the first stop that has been stopped (-1 if none).
Definition at line 111 of file run-jobs.hpp.
DynamicQueue<RetType,Heap> Gecode::Support::RunJobs< Jobs, RetType >::Master::rs [protected] |
Queue of not yet requested results.
Definition at line 113 of file run-jobs.hpp.
The documentation for this class was generated from the following file:
- gecode/support/run-jobs.hpp