#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. | |
Definition at line 96 of file run-jobs.hpp.
|
inline |
Initialize with job iterator j and maximal number of threads m.
Definition at line 258 of file run-jobs.hpp.
|
inline |
Destructor.
Definition at line 316 of file run-jobs.hpp.
|
inline |
Get next job witth index i, if possible.
Definition at line 200 of file run-jobs.hpp.
|
inline |
Report result r by a worker.
Definition at line 216 of file run-jobs.hpp.
|
inline |
Report that a job with index i has been stopped.
Definition at line 225 of file run-jobs.hpp.
|
inline |
Test whether all jobs are done.
Definition at line 252 of file run-jobs.hpp.
|
inline |
Run next job and return true if succesful and assign r to its result.
Definition at line 272 of file run-jobs.hpp.
|
inline |
Whether a job has thrown a JobStop exception.
Definition at line 194 of file run-jobs.hpp.
|
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.
|
inline |
Whether a new thread is needed for deletion.
Definition at line 303 of file run-jobs.hpp.
|
protected |
Mutex for synchronizing access.
Definition at line 99 of file run-jobs.hpp.
|
protected |
Event is triggered if a the first job is added to queue.
Definition at line 101 of file run-jobs.hpp.
|
protected |
Number of threads currently not in use.
Definition at line 103 of file run-jobs.hpp.
|
protected |
Input jobs.
Definition at line 105 of file run-jobs.hpp.
|
protected |
Index of next job to be created.
Definition at line 107 of file run-jobs.hpp.
|
protected |
Result from a the first stopped job (passed in exception)
Definition at line 109 of file run-jobs.hpp.
|
protected |
Index of the first stop that has been stopped (-1 if none)
Definition at line 111 of file run-jobs.hpp.
|
protected |
Queue of not yet requested results.
Definition at line 113 of file run-jobs.hpp.