File indexing completed on 2023-10-03 03:20:08
0001 /* 0002 SPDX-FileCopyrightText: 2022 David Faure <faure@kde.org> 0003 SPDX-License-Identifier: LGPL-2.0-or-later 0004 */ 0005 0006 #ifndef KIO_WORKERTHREAD_H 0007 #define KIO_WORKERTHREAD_H 0008 0009 #include <QMutex> 0010 #include <QThread> 0011 0012 namespace KIO 0013 { 0014 0015 class SlaveBase; 0016 class WorkerFactory; 0017 class WorkerThread : public QThread 0018 { 0019 Q_OBJECT 0020 public: 0021 WorkerThread(QObject *parent, WorkerFactory *factory, const QByteArray &appSocket); 0022 ~WorkerThread() override; 0023 0024 void abort(); 0025 0026 protected: 0027 void run() override; 0028 0029 private: 0030 void setWorker(KIO::SlaveBase *worker); 0031 0032 WorkerFactory *m_factory; // set by constructor, no mutex needed 0033 QByteArray m_appSocket; // set by constructor, no mutex needed 0034 0035 QMutex m_workerMutex; // protects m_worker, accessed by both threads 0036 KIO::SlaveBase *m_worker = nullptr; 0037 }; 0038 0039 } // namespace KIO 0040 0041 #endif // KIO_WORKERTHREAD_H