PDA

View Full Version : Background threads running in Qt Application.



vipu
19th September 2012, 08:15
I execute the code below



#include <QApplication>

int main (int argc, char** argv)
{
QApplication app(argc, argv);
app.exec();
}


and see the process on Windows Task Manager (WTM).

The WTM shows 7 threads for this application.

I read that Qt does not create any thread in the background then
why does it get reflected on WTM.

ChrisW67
19th September 2012, 08:48
That application produces exactly one thread on Windows XP and Windows 7 here. Since you have not given it a UI and there's no obvious way to exit it perhaps you are looking at multiple instances. Alternatively, perhaps you have use Microsoft's compiler and its runtime is doing something odd with threads.

8225
8226

Some of the networking functions have recently been implemented with an internal worker thread, so it is not true that Qt apps are completely thread-free.

vipu
20th September 2012, 04:28
I am using 4.6.3 version of Qt and mingw32-make compiler on Windows 7 where the test app shows 7 threads.

I built the test app on Linux using Qt 4.8.1 and there it shows only one thread.

ChrisW67
26th September 2012, 03:52
My earlier counter-examples were built with 4.8.0. So I went back to 4.6.2 (I didn't have a 4.6.3 available) and, not surprisingly, there is precisely one thread on Win XP, Win 7 64-bit and Win 7 32-bit. I do not know what you are doing or why you should care in any case.

8253 8254