BibleTime
btsourcesthread.h
Go to the documentation of this file.
1/*********
2*
3* In the name of the Father, and of the Son, and of the Holy Spirit.
4*
5* This file is part of BibleTime's source code, https://bibletime.info/
6*
7* Copyright 1999-2025 by the BibleTime developers.
8* The BibleTime source code is licensed under the GNU General Public License
9* version 2.0.
10*
11**********/
12
13#pragma once
14
15#include <QThread>
16
17#include <atomic>
18#include <QObject>
19#include <QString>
20
21
22class BtSourcesThread: public QThread {
23
24 Q_OBJECT
25
26public: // methods:
27
28 BtSourcesThread(QObject * parent = nullptr)
29 : QThread(parent)
30 , m_stop(false)
32 {}
33
34 void stop() noexcept { m_stop.store(true, std::memory_order_release); }
35
36 bool finishedSuccessfully() const noexcept
37 { return m_finishedSuccessfully.load(std::memory_order_acquire); }
38
39Q_SIGNALS:
40
41 void percentComplete(int percent);
42 void showMessage(QString const & msg);
43
44protected: // methods:
45
46 void run() override;
47
48private: // methods:
49
50 bool shouldStop() const noexcept
51 { return m_stop.load(std::memory_order_acquire); }
52
53private: // fields:
54
55 std::atomic<bool> m_stop;
56 std::atomic<bool> m_finishedSuccessfully;
57
58}; /* class BtSourcesThread */
std::atomic< bool > m_finishedSuccessfully
BtSourcesThread(QObject *parent=nullptr)
void stop() noexcept
void percentComplete(int percent)
void run() override
void showMessage(QString const &msg)
std::atomic< bool > m_stop
bool shouldStop() const noexcept
bool finishedSuccessfully() const noexcept