Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Solved Is my multithreading approach correct?

    General and Desktop
    multithreads gui workerthread
    2
    2
    859
    Loading More Posts
    • 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.
    • A
      alogim last edited by

      I wrote a simple GUI application for the rendering of an algorithm. Since I need a responsive and smooth user application, I divided the main GUI into three classes:

      • a computing thread, which simply does computations and emits new data as soon as they are computed via a signal
      • a processing class, which simply catches the computing thread's signals, processes them, and every n milliseconds emits a signal with the processed data to the GUI class; the signal is emitted only every n milliseconds, in order not to choke the GUI with thousands of signals
      • a GUI class, which catches signals from the processing class and update the GUI accordingly

      Now, everything seems to run smoothly. My first approach was with a computing thread and the GUI class, but I had to also process data in the computing thread, slowing down the execution.

      Is my approach correct?

      1 Reply Last reply Reply Quote 1
      • mrjj
        mrjj Lifetime Qt Champion last edited by

        Hi
        Its sounds like the classic
        worker - processing - display design with the twist of
        caching signals in processing.

        In my opinion is a very good design. :)

        1 Reply Last reply Reply Quote 2
        • First post
          Last post