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. Qtimer: Fireing multiple threads concurrently
Forum Updated to NodeBB v4.3 + New Features

Qtimer: Fireing multiple threads concurrently

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 2.1k 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.
  • D Offline
    D Offline
    DaveTheBrave
    wrote on last edited by
    #1

    I'm using a QTimer to initiate a series of FFTs. It's my understanding that Qtimer essentially creates a new thread each time its interval times out. However, it's not doing so until the current FFT expires. For example, if the timer's set to go off every half second, but the FFT takes one second, the timer only fires every second. If the timer's set to fire every 2 seconds, it fires every 2 seconds.

    Am I misunderstanding Qtimer?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dbzhang800
      wrote on last edited by
      #2

      Yes, you have misunderstand it.

      Timer never create new thread for you. If you want to the slot called in sub-thread, you must create QThread yourself.

      Timers will never time out earlier than the specified timeout value and they are not guaranteed to time out at the exact value specified.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andre
        wrote on last edited by
        #3

        QTimer has nothing to do with threads. Nothing at all. QTimer events don't create threads, and threads should not be used instead of/for timers.

        QTimer needs the eventloop of the thread it lives in to be running for it to work. If your thread is occupied calculating a FFT, the timer will not fire at the expected moment. Timers do not break or interrupt the normal flow of code.

        1 Reply Last reply
        0
        • D Offline
          D Offline
          DaveTheBrave
          wrote on last edited by
          #4

          Thanks! Question answered.

          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