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. How many implicit thread? (Windows mingw)
QtWS25 Last Chance

How many implicit thread? (Windows mingw)

Scheduled Pinned Locked Moved General and Desktop
5 Posts 4 Posters 4.0k 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.
  • C Offline
    C Offline
    calberto
    wrote on last edited by
    #1

    Someone know then Qt creates implicit threads? That is, for instance, I notice that using QTimer::singleShot() with a delay greater then zero create a new thread.

    I have an application that create a QThread by its own and an implicit thread with the Windows multimedia timer, but the total count of the application thread is 4 (after the start of the multimedia timer). I'm quite sure I have only zero-delayed singleShot() timer (in two the form class constructor), then some startTimer()/timerEvent() both in some "designer-created" class and in some class defined and instantiated in .cpp file.

    I expected to have one main thread, one multimedia timer thread and one worker thread, for a total of 3 against the actually 4.

    Maybe the multimedia timer create more than one thread, but I thinks this is not the case since the number of threads is incremented by one (from 3 to 4) only then I start the timer.

    Maybe there is a bug in my code, but so far I'm quite sure I create only one additional worker thread.

    With the debugger I can easily identify the main thread, the worker and, once started, the multimedia one. The other 1 seems to be waiting in a Sleep or somewhere in the windows kernel (RrcBCacheFree). When debugging I have two more thread.

    The GUI (win32-mingw) is composed by a QMainWindow with some docks and a QTabWidget for the central area. The tab uses some QTreeWidget (that, it seems to me, implicitly use timerEvent() to manages some updates). It doesn't use the network of other particular resources.

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tobias.hunger
      wrote on last edited by
      #2

      I do not understand your problem. Is this just curiosity about where the threads you observe come from or are the threads triggering some problem for you?

      1 Reply Last reply
      0
      • F Offline
        F Offline
        Franzk
        wrote on last edited by
        #3

        Sounds like the QtConcurrent thread pool...

        "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

        http://www.catb.org/~esr/faqs/smart-questions.html

        1 Reply Last reply
        0
        • C Offline
          C Offline
          calberto
          wrote on last edited by
          #4

          [quote author="Tobias Hunger" date="1291149234"]I do not understand your problem. Is this just curiosity about where the threads you observe come from or are the threads triggering some problem for you? [/quote]

          Mainly curiosity. Apparently these threads don't trigger any problem (I could have a bug somewhere and instantiate a class twice, but I already check for that and it seems this is not the case).

          My application is soft real-time (as far it is possible with Windows XP), the worker thread is at time critical priority and it seems it is not affected by the phantom thread. Anyway, I would like to know the usage of the resources.

          1 Reply Last reply
          0
          • D Offline
            D Offline
            DenisKormalev
            wrote on last edited by
            #5

            calberto, Qt itself creates threads sometimes (for example when you are using QtScript), but as you say your app should not be affected much by such threads. Most of time they are in sleep.

            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