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 | Worker
| The actual worker using a thread to run a job. More...
class | Master
class | Deleter
| A class to delete the master (running in parallel). 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 76 of file run-jobs.hpp.

## Constructor & Destructor Documentation

## RunJobs()

template<class Jobs, class RetType>

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 347 of file run-jobs.hpp.

## ~RunJobs()

template<class Jobs, class RetType>

Gecode::Support::RunJobs< Jobs, RetType >::~RunJobs | ( | void |  | ) |

inline

Destructor.

Definition at line 358 of file run-jobs.hpp.

## Member Function Documentation

## run()

template<class Jobs, class RetType>

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 352 of file run-jobs.hpp.

## stopped()

template<class Jobs, class RetType>

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 340 of file run-jobs.hpp.

## Member Data Documentation

## master

template<class Jobs, class RetType>

Master* Gecode::Support::RunJobs< Jobs, RetType >::master

protected

The actual master.

Definition at line 148 of file run-jobs.hpp.

The documentation for this class was generated from the following file:

- gecode/support/run-jobs.hpp