mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-27 23:40:39 +00:00
Forgot loop sequentialization
This commit is contained in:
parent
0fcf809d37
commit
f0f0fd2b75
@ -55,6 +55,7 @@ void ThreadPool::StartWorkers() {
|
||||
}
|
||||
|
||||
void ThreadPool::ParallelLoop(std::function<void(int,int)> loop, int lower, int upper) {
|
||||
mutex.lock();
|
||||
StartWorkers();
|
||||
int range = upper-lower;
|
||||
if(range >= numThreads*2) { // don't parallelize tiny loops
|
||||
@ -70,5 +71,6 @@ void ThreadPool::ParallelLoop(std::function<void(int,int)> loop, int lower, int
|
||||
} else {
|
||||
loop(lower, upper);
|
||||
}
|
||||
mutex.unlock();
|
||||
}
|
||||
|
||||
|
@ -34,8 +34,8 @@ private:
|
||||
};
|
||||
|
||||
// A thread pool manages a set of worker threads, and allows the execution of parallel loops on them
|
||||
// individual parallel loops are sequentialized, which should not be a problem as they should each
|
||||
// use the entire system
|
||||
// individual parallel loops are fully sequentialized to simplify synchronization, which should not
|
||||
// be a problem as they should each use the entire system
|
||||
class ThreadPool {
|
||||
public:
|
||||
ThreadPool(int numThreads);
|
||||
|
Loading…
Reference in New Issue
Block a user