Forgot loop sequentialization

This commit is contained in:
Peter Thoman committed 2013-05-01 13:20:25 +02:00
1 parent 0fcf809d37
commit f0f0fd2b75
2 files changed
+4 -2

No files matched your search

+2
View File
@@ -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();
}