summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMoritz 'Morty' Strübe <moritz.struebe@redheads.de>2020-03-19 18:52:44 (GMT)
committerMoritz 'Morty' Strübe <moritz.struebe@redheads.de>2020-03-19 18:52:44 (GMT)
commite8f0640e7e80351de68b40b5114f71fe94dc5fee (patch)
tree2f1a5b58b3df62ba292c50d32fba18bc4bb6249b /src
parent110cb591c076f84b6dee49b3fa2a1ebc107f7945 (diff)
downloadDoxygen-e8f0640e7e80351de68b40b5114f71fe94dc5fee.zip
Doxygen-e8f0640e7e80351de68b40b5114f71fe94dc5fee.tar.gz
Doxygen-e8f0640e7e80351de68b40b5114f71fe94dc5fee.tar.bz2
Replace QMutex and condition QWaitCondition with std::
Diffstat (limited to 'src')
-rw-r--r--src/dotrunner.cpp17
-rw-r--r--src/dotrunner.h7
2 files changed, 11 insertions, 13 deletions
diff --git a/src/dotrunner.cpp b/src/dotrunner.cpp
index 208250a..a42c242 100644
--- a/src/dotrunner.cpp
+++ b/src/dotrunner.cpp
@@ -256,19 +256,18 @@ error:
void DotRunnerQueue::enqueue(DotRunner *runner)
{
- QMutexLocker locker(&m_mutex);
+ std::lock_guard<std::mutex> locker(m_mutex);
m_queue.push(runner);
- m_bufferNotEmpty.wakeAll();
+ m_bufferNotEmpty.notify_all();
}
DotRunner *DotRunnerQueue::dequeue()
{
- QMutexLocker locker(&m_mutex);
- while (m_queue.empty())
- {
- // wait until something is added to the queue
- m_bufferNotEmpty.wait(&m_mutex);
- }
+ std::unique_lock<std::mutex> locker(m_mutex);
+
+ // wait until something is added to the queue
+ m_bufferNotEmpty.wait(locker, [this]() {return !m_queue.empty(); });
+
DotRunner *result = m_queue.front();
m_queue.pop();
return result;
@@ -276,7 +275,7 @@ DotRunner *DotRunnerQueue::dequeue()
uint DotRunnerQueue::count() const
{
- QMutexLocker locker(&m_mutex);
+ std::lock_guard<std::mutex> locker(m_mutex);
return m_queue.size();
}
diff --git a/src/dotrunner.h b/src/dotrunner.h
index 48b3dcb..2fa0b61 100644
--- a/src/dotrunner.h
+++ b/src/dotrunner.h
@@ -18,10 +18,9 @@
#include "qcstring.h"
#include "qlist.h"
-#include "qwaitcondition.h"
#include "qthread.h"
#include <queue>
-#include "qmutex.h"
+#include <mutex>
/** Minimal constant string class that is thread safe, once initialized. */
class DotConstString
@@ -114,9 +113,9 @@ class DotRunnerQueue
DotRunner *dequeue();
uint count() const;
private:
- QWaitCondition m_bufferNotEmpty;
+ std::condition_variable m_bufferNotEmpty;
std::queue<DotRunner *> m_queue;
- mutable QMutex m_mutex;
+ mutable std::mutex m_mutex;
};
/** Worker thread to execute a dot run */