ppsspp/Core/ThreadPools.cpp

17 lines
466 B
C++
Raw Normal View History

#include "ThreadPools.h"
2013-05-01 12:08:01 +00:00
#include "../Core/Config.h"
#include "Common/MakeUnique.h"
2013-05-01 12:08:01 +00:00
std::unique_ptr<ThreadPool> GlobalThreadPool::pool;
std::once_flag GlobalThreadPool::init_flag;
2013-05-01 12:08:01 +00:00
2013-06-02 12:26:51 +00:00
void GlobalThreadPool::Loop(const std::function<void(int,int)>& loop, int lower, int upper) {
std::call_once(init_flag, Inititialize);
2013-05-01 12:08:01 +00:00
pool->ParallelLoop(loop, lower, upper);
}
void GlobalThreadPool::Inititialize() {
pool = make_unique<ThreadPool>(g_Config.iNumWorkerThreads);
2013-05-01 12:08:01 +00:00
}