1/*
2 SPDX-FileCopyrightText: 2022 David Faure <faure@kde.org>
3 SPDX-License-Identifier: LGPL-2.0-or-later
4*/
5
6#ifndef KIO_WORKERTHREAD_H
7#define KIO_WORKERTHREAD_H
8
9#include <QMutex>
10#include <QThread>
11
12namespace KIO
13{
14
15class SlaveBase;
16class WorkerFactory;
17class WorkerThread : public QThread
18{
19 Q_OBJECT
20public:
21 WorkerThread(QObject *parent, WorkerFactory *factory, const QByteArray &appSocket);
22 ~WorkerThread() override;
23
24 void abort();
25
26protected:
27 void run() override;
28
29private:
30 void setWorker(KIO::SlaveBase *worker);
31
32 WorkerFactory *m_factory; // set by constructor, no mutex needed
33 QByteArray m_appSocket; // set by constructor, no mutex needed
34
35 QMutex m_workerMutex; // protects m_worker, accessed by both threads
36 KIO::SlaveBase *m_worker = nullptr;
37};
38
39} // namespace KIO
40
41#endif // KIO_WORKERTHREAD_H
42

source code of kio/src/core/workerthread_p.h