File indexing completed on 2024-06-23 04:46:59

0001 /*
0002     SPDX-FileCopyrightText: 1998-2009 Sebastian Trueg <trueg@k3b.org>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef _K3B_THREAD_H_
0007 #define _K3B_THREAD_H_
0008 
0009 #include "k3bdevicetypes.h"
0010 #include "k3b_export.h"
0011 #include <QThread>
0012 
0013 
0014 namespace K3b {
0015     namespace Device {
0016         class Device;
0017     }
0018     class ThreadJob;
0019 
0020     /**
0021      * \warning This class is internal to ThreadJob
0022      *
0023      * See ThreadJob for more information.
0024      */
0025     class LIBK3B_EXPORT Thread : public QThread
0026     {
0027         Q_OBJECT
0028 
0029     public:
0030         explicit Thread( ThreadJob* parent = 0 );
0031         ~Thread() override;
0032 
0033         void ensureDone();
0034         bool success() const;
0035 
0036         /**
0037          * waits until all running Thread have finished.
0038          * This is used by Application.
0039          */
0040         static void waitUntilFinished();
0041 
0042     protected:
0043         void run() override;
0044 
0045     private Q_SLOTS:
0046         void slotEnsureDoneTimeout();
0047 
0048     private:
0049         class Private;
0050         Private* d;
0051     };
0052 }
0053 
0054 #endif