From 5e86082230415cbc4a61d39dd1808b6500542e61 Mon Sep 17 00:00:00 2001 From: Nodir Temirkhodjaev Date: Fri, 10 Feb 2023 13:16:24 +0300 Subject: [PATCH] UI: AppInfoWorker: Low priority thread --- src/ui/appinfo/appinfoworker.h | 2 ++ src/ui/util/worker/workerobject.cpp | 2 ++ src/ui/util/worker/workerobject.h | 3 +++ 3 files changed, 7 insertions(+) diff --git a/src/ui/appinfo/appinfoworker.h b/src/ui/appinfo/appinfoworker.h index 7b526b4f..2effd28c 100644 --- a/src/ui/appinfo/appinfoworker.h +++ b/src/ui/appinfo/appinfoworker.h @@ -15,6 +15,8 @@ public: AppInfoManager *manager() const; + QThread::Priority priority() const override { return QThread::LowPriority; } + void run() override; protected: diff --git a/src/ui/util/worker/workerobject.cpp b/src/ui/util/worker/workerobject.cpp index cc8023e1..34e4db38 100644 --- a/src/ui/util/worker/workerobject.cpp +++ b/src/ui/util/worker/workerobject.cpp @@ -7,6 +7,8 @@ WorkerObject::WorkerObject(WorkerManager *manager) : m_manager(manager) { } void WorkerObject::run() { + QThread::currentThread()->setPriority(priority()); + for (;;) { WorkerJob *job = manager()->dequeueJob(); if (!job) diff --git a/src/ui/util/worker/workerobject.h b/src/ui/util/worker/workerobject.h index 92a6b2bb..80d50906 100644 --- a/src/ui/util/worker/workerobject.h +++ b/src/ui/util/worker/workerobject.h @@ -3,6 +3,7 @@ #include #include +#include class WorkerJob; class WorkerManager; @@ -14,6 +15,8 @@ public: WorkerManager *manager() const { return m_manager; } + virtual QThread::Priority priority() const { return QThread::NormalPriority; } + void run() override; protected: