Bug in the Mandelbrot example?
-
In https://doc.qt.io/qt-6/qtcore-threads-mandelbrot-example.html it says:
If we discover inside the loop that restart has been set to true (by render()), we break out of the loop immediately, so that the control quickly returns to the very top of the outer loop (the forever loop) and we fetch the new rendering parameters.However when I look the code I see the break is:
void RenderThread::run() { forever { // ... while (pass < NumPasses) { // ... for (int y = -halfHeight; y < halfHeight; ++y) { if (restart) break;The
breakwill break the for loop but not he while loop. I don't see anything that breaks the while loop to "quickly return" to the forever loop.Am I missing something or is this a bug?
Thanks
-
In https://doc.qt.io/qt-6/qtcore-threads-mandelbrot-example.html it says:
If we discover inside the loop that restart has been set to true (by render()), we break out of the loop immediately, so that the control quickly returns to the very top of the outer loop (the forever loop) and we fetch the new rendering parameters.However when I look the code I see the break is:
void RenderThread::run() { forever { // ... while (pass < NumPasses) { // ... for (int y = -halfHeight; y < halfHeight; ++y) { if (restart) break;The
breakwill break the for loop but not he while loop. I don't see anything that breaks the while loop to "quickly return" to the forever loop.Am I missing something or is this a bug?
Thanks
You did not post the whole code. After the if() statement pass is increased so the while loop is ready very quickly and it returns to the forever()
Not optimal but also not really a problem.
-
@maliberty said in Bug in the Mandelbrot example?:
we break out of the loop immediately
So not "immediately" but quickly enough.