2013-05-03 06:31:53 +00:00
|
|
|
#include "ThreadPools.h"
|
2013-05-01 12:08:01 +00:00
|
|
|
|
|
|
|
#include "../Core/Config.h"
|
|
|
|
|
2013-06-02 12:26:51 +00:00
|
|
|
std::shared_ptr<ThreadPool> GlobalThreadPool::pool;
|
2013-05-01 12:08:01 +00:00
|
|
|
bool GlobalThreadPool::initialized = false;
|
|
|
|
|
2013-06-02 12:26:51 +00:00
|
|
|
void GlobalThreadPool::Loop(const std::function<void(int,int)>& loop, int lower, int upper) {
|
2013-05-01 12:08:01 +00:00
|
|
|
Inititialize();
|
|
|
|
pool->ParallelLoop(loop, lower, upper);
|
|
|
|
}
|
|
|
|
|
|
|
|
void GlobalThreadPool::Inititialize() {
|
|
|
|
if(!initialized) {
|
|
|
|
pool = std::make_shared<ThreadPool>(g_Config.iNumWorkerThreads);
|
|
|
|
initialized = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|