File indexing completed on 2024-11-10 03:35:19
0001 /* 0002 SPDX-FileCopyrightText: 2010 Nokia Corporation and /or its subsidiary(-ies) <qt-info@nokia.com> 0003 All rights reserved. 0004 0005 This file is part of the examples of the Qt Toolkit. 0006 SPDX-License-Identifier: BSD-3-Clause 0007 */ 0008 0009 #ifndef THREAD_H 0010 #define THREAD_H 0011 0012 #include <QMutex> 0013 #include <QThread> 0014 #include <QWaitCondition> 0015 0016 class QSignalMapper; 0017 0018 class Thread: public QThread 0019 { 0020 Q_OBJECT 0021 0022 public: 0023 explicit Thread( QObject * const parent = nullptr ); 0024 ~Thread() override; 0025 0026 void launchWorker( QObject * const worker ); 0027 void stop(); 0028 0029 Q_SIGNALS: 0030 void aboutToStop(); 0031 0032 private Q_SLOTS: 0033 void stopExecutor(); 0034 void setReadyStatus(); 0035 0036 private: 0037 QObject * m_worker; 0038 QSignalMapper * m_shutDownHelper; 0039 QWaitCondition m_waitCondition; 0040 QMutex m_mutex; 0041 }; 0042 0043 #endif