Threads @Start of Qt Application
When we launch Qt Widgets based application, it starts 3 or 4 threads. Any details on what are these threads ? What is the functionality each these threads ?
Any details on what are these threads?
Qt may spawn threads for different things. For example it may need them for
QNetworkAccessManager's requests processing, or for
QThreadPoolor for QtConcurrent's internal pool, or for Windows' integration and so on.
What is the functionality each these threads?
They're internal and inaccessible for the most part (except for thread pools).
To add to @kshegunov, some of these threads can also spawned by the OS itself and not by Qt.
Thank you for the answer. I have just created simple application which show one QPushButton. Nothing else in the program. When I start event loop using Application.exec it starts one/two threads. I feel these threads are explicitly created in inside the Qt code. Wanted to know what this thread is doing. I tried this on MAC.
I feel these threads are explicitly created in inside the Qt code.
How do you gather that?
I ran the code without app.exec(). Thread count is less. When app.exec() thread count increases.
Because if you don't call exec, you won't have the event dispatcher running, no GUI running etc. Like I said, there are things that depends on the OS you are running on.