diff --git a/thread/threadpool.cpp b/thread/threadpool.cpp index 30fbb9af96..dcc733025d 100644 --- a/thread/threadpool.cpp +++ b/thread/threadpool.cpp @@ -64,10 +64,13 @@ void ThreadPool::ParallelLoop(function loop, int lower, int upper // could do slightly better load balancing for the generic case, // but doesn't matter since all our loops are power of 2 int chunk = range/numThreads; - for(int s=lower, i=0; iProcess(bind(loop, s, std::min(s+chunk,upper))); + int s = lower; + for(int i=0; iProcess(bind(loop, s, s+chunk)); + s+=chunk; } - for(int i=0; iWaitForCompletion(); } } else {