Experimental: remove use of mutex when threaded
In theory, it seems that each pixel is only written to once, regardless of how many threads there are. Theoretically, this means that locks are not required.
This commit is contained in:
parent
075aab2a57
commit
13bf59dcc8
1 changed files with 2 additions and 2 deletions
|
@ -429,7 +429,7 @@ Ex02::RT::Image Ex02::RT::renderColorsWithSpheres(unsigned int outputWidth,
|
|||
}
|
||||
} else {
|
||||
std::vector<std::thread> threads;
|
||||
std::mutex mutex;
|
||||
// std::mutex mutex;
|
||||
unsigned int range = outputHeight / threadCount;
|
||||
for (unsigned int threadIdx = 0; threadIdx < threadCount; ++threadIdx) {
|
||||
unsigned int start = range * threadIdx;
|
||||
|
@ -444,7 +444,7 @@ Ex02::RT::Image Ex02::RT::renderColorsWithSpheres(unsigned int outputWidth,
|
|||
yIteration(y, mutex);
|
||||
}
|
||||
},
|
||||
start, end, &mutex));
|
||||
start, end, nullptr));
|
||||
}
|
||||
for (std::thread &thread : threads) {
|
||||
thread.join();
|
||||
|
|
Loading…
Reference in a new issue