From 1dc8705c65f87c1dfa2696b7c893719ead5c1020 Mon Sep 17 00:00:00 2001 From: tobtoht Date: Wed, 1 Mar 2023 21:21:48 +0100 Subject: [PATCH] scheduler: don't hardcode maxThreadCount, set minimum to 8 --- src/main.cpp | 5 +++++ src/utils/scheduler.cpp | 4 ---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 15894bef..cf78968a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -232,6 +232,11 @@ if (AttachConsole(ATTACH_PARENT_PROCESS)) { EventFilter filter; app.installEventFilter(&filter); + auto *pool = QThreadPool::globalInstance(); + if (pool->maxThreadCount() < 8) { + pool->setMaxThreadCount(8); + } + WindowManager windowManager(QCoreApplication::instance(), &filter); QObject::connect(&app, &SingleApplication::instanceStarted, [&windowManager]() { diff --git a/src/utils/scheduler.cpp b/src/utils/scheduler.cpp index 835c408b..46101654 100644 --- a/src/utils/scheduler.cpp +++ b/src/utils/scheduler.cpp @@ -6,10 +6,6 @@ FutureScheduler::FutureScheduler(QObject *parent) : QObject(parent), Alive(0), Stopping(false) { - static std::once_flag once; - std::call_once(once, []() { - QThreadPool::globalInstance()->setMaxThreadCount(4); - }); } FutureScheduler::~FutureScheduler() -- 2.52.0