1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-17 23:28:50 -05: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

View File

@ -116,7 +116,7 @@ set(sdrbase_SOURCES
#sdrbase/util/miniz.cpp
sdrbase/util/samplesourceserializer.cpp
sdrbase/util/simpleserializer.cpp
sdrbase/util/spinlock.cpp
#sdrbase/util/spinlock.cpp
)
set(sdrbase_HEADERS
@ -194,7 +194,7 @@ set(sdrbase_HEADERS
#include/util/miniz.h
include/util/samplesourceserializer.h
include/util/simpleserializer.h
include/util/spinlock.h
#include/util/spinlock.h
)
set(sdrbase_SOURCES

View File

@ -45,7 +45,7 @@ Use `cmake ../ -DV4L-RTL=ON` to build the Linux kernel driver for RTL-SDR (Exper
<h2>BladeRF</h2>
BladeRF is supported through the libbladerf library that should be installed in your system for proper build of the software and operation support.
BladeRF is supported through the libbladerf library that should be installed in your system for proper build of the software and operation support. Add `libbladerf-dev` to the list of dependencies to install.
If you use your own location for libbladeRF install directory you need to specify library and include locations. Example with `/opt/install/libbladerf` with the following defines on `cmake` command line:
@ -59,7 +59,7 @@ The interface is built in the software and do not require additional libraries o
<h2>RTL-SDR</h2>
RTL-SDR based dongles are supported through the librtlsdr library that should be installed in your system for proper build of the software and operation support.
RTL-SDR based dongles are supported through the librtlsdr library that should be installed in your system for proper build of the software and operation support. Add `librtlsdr-dev` to the list of dependencies to install.
If you use your own location for librtlsdr install directory you need to specify library and include locations. Example with `/opt/install/librtlsdr` with the following defines on `cmake` command line:

View File

@ -20,7 +20,7 @@
#include <QObject>
#include <QQueue>
#include "spinlock.h"
#include <QMutex>
#include "util/export.h"
class Message;
@ -42,7 +42,7 @@ signals:
void messageEnqueued();
private:
Spinlock m_lock;
QMutex m_lock;
QQueue<Message*> m_queue;
};

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();
}