summaryrefslogtreecommitdiffstats
path: root/src/mixxxapplication.cpp
diff options
context:
space:
mode:
authorUwe Klotz <uklotz@mixxx.org>2019-08-19 00:20:04 +0200
committerUwe Klotz <uklotz@mixxx.org>2019-08-19 00:20:49 +0200
commitc8af49fb2288c048f3e84076a4b2bdab6a8a8b79 (patch)
tree0f5a014d7646166b048fcd17af622ca0e4079215 /src/mixxxapplication.cpp
parent6d9ec4ecd5e0e501c88b098053b533e638e80f2f (diff)
Initialize the global thread pool with at least 4 threads
Diffstat (limited to 'src/mixxxapplication.cpp')
-rw-r--r--src/mixxxapplication.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/mixxxapplication.cpp b/src/mixxxapplication.cpp
index 247edfbff8..d965fed6a0 100644
--- a/src/mixxxapplication.cpp
+++ b/src/mixxxapplication.cpp
@@ -7,6 +7,7 @@
#include "control/controlproxy.h"
#include "library/crate/crateid.h"
#include "track/track.h"
+#include "util/math.h"
// When linking Qt statically on Windows we have to Q_IMPORT_PLUGIN all the
// plugins we link in build/depends.py.
@@ -39,10 +40,11 @@ MixxxApplication::MixxxApplication(int& argc, char** argv)
m_pTouchShift(NULL) {
registerMetaTypes();
- // The global thread pool is initialized with the default
- // number of treads. If a custom configuration is desired
- // it should be done here before scheduling any tasks!
- DEBUG_ASSERT(QThreadPool::globalInstance()->maxThreadCount() == QThread::idealThreadCount());
+ // Initialize the thread pool with at least 4 threads, even if
+ // less cores are available. These will be used for loading
+ // external libraries and other tasks.
+ QThreadPool::globalInstance().setMaxThreadCount(
+ math_max(4, QThread::idealThreadCount()));
}
MixxxApplication::~MixxxApplication() {