Qt global thread pool max thread count
Recently I encountered that some threads are not launching in our application using QConcurrentRun.
If you launched the same worker function over QThread it was working.
So digging into this gave us this problem with defaults for Qt's global threadpool.
Basically Qt sets global threadpool's max thread count to the no of cores you have on your processor. We were easily running out of the default four max threads.
So we upped the count to 32 using following function:
QThreadPool::globalInstance()->setMaxThreadCount(32);
We set this at start of the program in main. Things have been fine since then!
If you launched the same worker function over QThread it was working.
So digging into this gave us this problem with defaults for Qt's global threadpool.
Basically Qt sets global threadpool's max thread count to the no of cores you have on your processor. We were easily running out of the default four max threads.
So we upped the count to 32 using following function:
QThreadPool::globalInstance()->setMaxThreadCount(32);
We set this at start of the program in main. Things have been fine since then!
Comments
Post a Comment