paysages3d/src/system/ParallelPool.h
Michaël Lemaire 6166031c8b Speeded up compile time
Reworked *_global.h heavy inclusions
2015-11-18 19:37:00 +01:00

44 lines
704 B
C++

#ifndef PARALLELPOOL_H
#define PARALLELPOOL_H
#include "system_global.h"
#include <vector>
namespace paysages {
namespace system {
/*!
* Pool to handle a group of threads doing the same task.
*/
class SYSTEMSHARED_EXPORT ParallelPool {
public:
ParallelPool();
virtual ~ParallelPool();
/*!
* Start the effective work.
*/
void start(int thread_count = -1);
/*!
* Method called from each thread to do actual work.
*/
virtual void work() = 0;
/*!
* Method called once to interrupt all threads.
*/
virtual void interrupt();
protected:
bool running;
private:
std::vector<Thread *> threads;
};
}
}
#endif // PARALLELPOOL_H