1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-05 07:24:44 -04:00

Deep redesign: replaced smelly Spinlock mutex by standard QMutex in message queue

This commit is contained in:
f4exb
2015-09-02 01:51:49 +02:00
parent 4fba8144dc
commit 234fb61955
4 changed files with 11 additions and 9 deletions
+5 -3
View File
@@ -16,12 +16,13 @@
///////////////////////////////////////////////////////////////////////////////////
#include <QDebug>
#include <QMutexLocker>
#include "util/messagequeue.h"
#include "util/message.h"
MessageQueue::MessageQueue(QObject* parent) :
QObject(parent),
m_lock(),
m_lock(QMutex::Recursive),
m_queue()
{
}
@@ -54,7 +55,7 @@ void MessageQueue::push(Message* message, bool emitSignal)
Message* MessageQueue::pop()
{
SpinlockHolder spinlockHolder(&m_lock);
QMutexLocker locker(&m_lock);
if (m_queue.isEmpty())
{
@@ -68,12 +69,13 @@ Message* MessageQueue::pop()
int MessageQueue::size()
{
SpinlockHolder spinlockHolder(&m_lock);
QMutexLocker locker(&m_lock);
return m_queue.size();
}
void MessageQueue::clear()
{
QMutexLocker locker(&m_lock);
m_queue.clear();
}