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. Is my multithreading approach correct?
QtWS25 Last Chance

Is my multithreading approach correct?

Scheduled Pinned Locked Moved Solved General and Desktop
multithreadsguiworkerthread
2 Posts 2 Posters 1.1k Views
  • 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 Offline
    A Offline
    alogim
    wrote on 25 Feb 2016, 09:24 last edited by
    #1

    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
    1
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 25 Feb 2016, 09:31 last edited by
      #2

      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
      2

      2/2

      25 Feb 2016, 09:31

      • Login

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