diff options
author | Sefa Eyeoglu <contact@scrumplex.net> | 2022-08-28 11:03:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-28 11:03:12 +0200 |
commit | afcd669d2f6934c2b6076939d7665f791d495994 (patch) | |
tree | b5868b4e26fc52a6b48443847fbd7ef0aafee908 /launcher/tasks | |
parent | fbf542d2051576ee25556c3b28112eea094da309 (diff) | |
parent | 7b27f200b1f131f0ea3b23433974cbe68eb979bb (diff) | |
download | PrismLauncher-afcd669d2f6934c2b6076939d7665f791d495994.tar.gz PrismLauncher-afcd669d2f6934c2b6076939d7665f791d495994.tar.bz2 PrismLauncher-afcd669d2f6934c2b6076939d7665f791d495994.zip |
Merge pull request #965 from flowln/fat_files_in_memory
Refactor a bit EnsureMetadataTask and calculate hashes in a incremental manner
Diffstat (limited to 'launcher/tasks')
-rw-r--r-- | launcher/tasks/ConcurrentTask.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/launcher/tasks/ConcurrentTask.cpp b/launcher/tasks/ConcurrentTask.cpp index b88cfb13..ab7cbd03 100644 --- a/launcher/tasks/ConcurrentTask.cpp +++ b/launcher/tasks/ConcurrentTask.cpp @@ -1,10 +1,11 @@ #include "ConcurrentTask.h" #include <QDebug> +#include <QCoreApplication> ConcurrentTask::ConcurrentTask(QObject* parent, QString task_name, int max_concurrent) : Task(parent), m_name(task_name), m_total_max_size(max_concurrent) -{} +{ setObjectName(task_name); } ConcurrentTask::~ConcurrentTask() { @@ -36,8 +37,9 @@ void ConcurrentTask::executeTask() { m_total_size = m_queue.size(); - for (int i = 0; i < m_total_max_size; i++) - startNext(); + for (int i = 0; i < m_total_max_size; i++) { + QMetaObject::invokeMethod(this, &ConcurrentTask::startNext, Qt::QueuedConnection); + } } bool ConcurrentTask::abort() @@ -91,6 +93,8 @@ void ConcurrentTask::startNext() setStepStatus(next->isMultiStep() ? next->getStepStatus() : next->getStatus()); updateState(); + QCoreApplication::processEvents(); + next->start(); } |