diff options
author | Moritz 'Morty' Strübe <moritz.struebe@redheads.de> | 2020-03-19 19:56:59 (GMT) |
---|---|---|
committer | Moritz 'Morty' Strübe <moritz.struebe@redheads.de> | 2020-03-21 10:31:28 (GMT) |
commit | 5a6f35b0de84350b867e06b3eb85622c4cface37 (patch) | |
tree | e01197784bb15668b99f8fac5fbcf697cecce097 | |
parent | 00e79b8621b00f72ea56f81b1c4df9eae4ed9252 (diff) | |
download | Doxygen-5a6f35b0de84350b867e06b3eb85622c4cface37.zip Doxygen-5a6f35b0de84350b867e06b3eb85622c4cface37.tar.gz Doxygen-5a6f35b0de84350b867e06b3eb85622c4cface37.tar.bz2 |
Replace QThread with std::thread
-rw-r--r-- | src/dotrunner.cpp | 6 | ||||
-rw-r--r-- | src/dotrunner.h | 9 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/dotrunner.cpp b/src/dotrunner.cpp index 21967cb..28c49cd 100644 --- a/src/dotrunner.cpp +++ b/src/dotrunner.cpp @@ -289,4 +289,10 @@ void DotWorkerThread::run() { runner->run(); } +}
+
+void DotWorkerThread::start()
+{
+ assert(!m_thread);
+ m_thread = std::make_unique<std::thread>(&DotWorkerThread::run, this);
} diff --git a/src/dotrunner.h b/src/dotrunner.h index 052d5f7..e08ae6f 100644 --- a/src/dotrunner.h +++ b/src/dotrunner.h @@ -17,10 +17,11 @@ #define DOTRUNNER_H #include "qcstring.h" -#include "qthread.h" +#include <thread> #include <list> #include <queue> #include <mutex> +#include <memory> /** Minimal constant string class that is thread safe, once initialized. */ class DotConstString @@ -119,12 +120,16 @@ class DotRunnerQueue }; /** Worker thread to execute a dot run */ -class DotWorkerThread : public QThread +class DotWorkerThread { public: DotWorkerThread(DotRunnerQueue *queue); void run(); + void start(); + bool isRunning() { return m_thread && m_thread->joinable(); } + void wait() { m_thread->join(); } private: + std::unique_ptr<std::thread> m_thread; DotRunnerQueue *m_queue; }; |