Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Mandelbrot example : problems to understand the code



  • Hi,

    I have a problem with the Mandelbrot QT example (QT Mandelbrot example), my CPU is running at 25% all the time, just like if a task was done in continue (I have around 1-2% when application is closed).
    However no event come (I don't move the mouse or anything) and the code shows a

            mutex.lock();
            if (!restart)
                condition.wait(&mutex);
            restart = false;
            mutex.unlock();
    

    If I understand those lines in source, the CPU should stop working when the render is done, why is it not the case? Are QThread always use the CPU like that?

    S├ębastien L.


  • Qt Champions 2019

    The last render pass can take a lot of time. Put some debug output into the run function to see if the rendering is really finished.



  • Ok sorry, indeed the last 2 pass took several minutes to finish. I set the number of pass to 6 instead of 8 and get the result after 2-3 minutes. And then the CPU usage goes to 0% as supposed.
    Thank you.


Log in to reply