Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Mandelbrot example : problems to understand the code

Mandelbrot example : problems to understand the code

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 428 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • SebastienLS Offline
    SebastienLS Offline
    SebastienL
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      4
      • SebastienLS Offline
        SebastienLS Offline
        SebastienL
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved