Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. [Solved] Timer routines that overrun the timer period
Forum Updated to NodeBB v4.3 + New Features

[Solved] Timer routines that overrun the timer period

Scheduled Pinned Locked Moved Mobile and Embedded
4 Posts 2 Posters 2.2k 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.
  • E Offline
    E Offline
    Endless
    wrote on last edited by
    #1

    I'm working on an ARM9 linux device. I have a timer that goes off every 300ms to update the display. I connect the timeout() signal of the timer with a slot function called updateTimer(). Depending on the inputs, I may have to do some file processing and handling which I'm sure is going to take more than 300ms. Can I leave it right in the updateTimer() function, or should I set up another signal/slot connection in the same object to do the file stuff?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      miroslav
      wrote on last edited by
      #2

      I would suggest that when the timer fires, you create a processing job and have it executed asynchronously, for example by a runnable. This way you will be able to receive all the timer calls, at least.

      Mirko Boehm | mirko@kde.org | KDE e.V.
      FSFE Fellow
      Qt Certified Specialist

      1 Reply Last reply
      0
      • E Offline
        E Offline
        Endless
        wrote on last edited by
        #3

        What do you mean by a "processing job?"

        1 Reply Last reply
        0
        • M Offline
          M Offline
          miroslav
          wrote on last edited by
          #4

          Whatever you are trying to do when the timer fires. You said:

          [quote author="Endless" date="1328541506"]Depending on the inputs, I may have to do some file processing and handling which I'm sure is going to take more than 300ms.[/quote]

          Just take whatever you do there, wrap it in a runnable, and stick it in the QThreadPool. QThreadPool has examples on how to do that. You don't want to do anything that can take 300ms or longer in the main thread, in general.

          Mirko Boehm | mirko@kde.org | KDE e.V.
          FSFE Fellow
          Qt Certified Specialist

          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