Fix threadIndex mistakenly getting captured by reference

This commit is contained in:
Magnus Norddahl 2022-02-15 14:35:32 +01:00
parent 6729561354
commit c5d09682a0

View file

@ -505,7 +505,7 @@ void CPURaytracer::RunJob(int count, std::function<void(int)> callback)
std::vector<std::thread> threads; std::vector<std::thread> threads;
for (int threadIndex = 0; threadIndex < numThreads; threadIndex++) for (int threadIndex = 0; threadIndex < numThreads; threadIndex++)
{ {
threads.push_back(std::thread([&]() { threads.push_back(std::thread([&, threadIndex]() {
for (int i = threadIndex; i < count; i += numThreads) for (int i = threadIndex; i < count; i += numThreads)
{ {