Qt World Summit: Submit your Presentation

Qt Architecture (Threads)

  • Hi,

    When I start a -QT- Qt application, I see that there are two threads which is running.
    One with Event Loop (main Thread??) and probably other which does all the rendering etc. Similarly when I start QtWebkit, there are extra threads created for Network, JSC. (Hope my understanding is correct).

    I have a C++ Application, where I am going to use -QT- Qt . But the application has one requirements on priority of tasks/Threads. So I have to control all the threads created from -QT- Qt (Even internal) with a SCHED_RR and setting up the specified priority.

    Does -QT- Qt provides a way to do this? If so how can I do it?

    Edit: The toolkit is called Qt, not QT; Andre
    Thanks Andre. Some how, I am doing this mistake from quite sometime, i will try to remember this next time

  • By default, Qt only uses one thread, depending on your platform, there might be an extra one pumping events from X or managing network I/O.
    Anyway, you can set the main application thread priority using:

    If you need to control the priority of the extra background thread, you will have to look at the implementation of the QAbstractEventDispatcher for your platform and see when this extra thread is spawned. This is not public Qt API, it's Qt internals. You'd better know what you are doing with that.

Log in to reply