ConcurrentOperationRunner Class

class QInstaller::ConcurrentOperationRunner

The ConcurrentOperationRunner class can be used to perform installer operations concurrently. More...

Header: #include <ConcurrentOperationRunner>
Inherits: QObject

Public Functions

ConcurrentOperationRunner(QObject *parent = nullptr)
ConcurrentOperationRunner(QInstaller::OperationList *operations, const KDUpdater::UpdateOperation::OperationType type, QObject *parent = nullptr)
virtual ~ConcurrentOperationRunner()
QHash<QInstaller::Operation *, bool> run()
void setMaxThreadCount(int count)
void setOperations(QInstaller::OperationList *operations)
void setType(const KDUpdater::UpdateOperation::OperationType type)

Public Slots

void cancel()


void finished()
void operationStarted(QInstaller::Operation *operation)
void progressChanged(const int completed, const int total)

Detailed Description

The class accepts an operation list of any registered operation type. It can be used to execute the Backup, Perform, or Undo steps of the operations. The operations are run in a separate thread pool of this class, which by default limits the maximum number of threads to the ideal number of logical processor cores in the system.

Member Function Documentation

[explicit] ConcurrentOperationRunner::ConcurrentOperationRunner(QObject *parent = nullptr)

Constructs an operation runner with parent as the parent object.

[explicit] ConcurrentOperationRunner::ConcurrentOperationRunner(QInstaller::OperationList *operations, const KDUpdater::UpdateOperation::OperationType type, QObject *parent = nullptr)

Constructs an operation runner with operations of type type to be performed, and parent as the parent object.

[virtual noexcept] ConcurrentOperationRunner::~ConcurrentOperationRunner()

Destroys the instance and releases resources.

[slot] void ConcurrentOperationRunner::cancel()

Cancels operations pending for an asynchronous run.

Note: This does not stop already running operations, which should provide a separate mechanism for canceling.

[signal] void ConcurrentOperationRunner::finished()

Emitted when the execution of all pooled operations is finished.

[signal] void ConcurrentOperationRunner::operationStarted(QInstaller::Operation *operation)

Emitted when the execution of operation is started.

[signal] void ConcurrentOperationRunner::progressChanged(const int completed, const int total)

Emitted when the count of completed of the total operations changes.

QHash<QInstaller::Operation *, bool> ConcurrentOperationRunner::run()

Performs the current operations. Returns a hash of pointers to the performed operation objects and their results. The result is a boolean value.

void ConcurrentOperationRunner::setMaxThreadCount(int count)

Sets the maximum count of threads used by the thread pool of this class. A value of 0 sets the count automatically to ideal number of threads.

void ConcurrentOperationRunner::setOperations(QInstaller::OperationList *operations)

Sets the list of operations to be performed to operations.

void ConcurrentOperationRunner::setType(const KDUpdater::UpdateOperation::OperationType type)

Sets type of operations to be performed. This can be either Backup, Perform, or Undo.

© 2021 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. The Qt Company, Qt and their respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.