1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 17:28:50 -05:00

Merge pull request #1431 from srcejon/feature_threading_cleanup

Feature threading cleanup
This commit is contained in:
Edouard Griffiths 2022-09-21 00:19:11 +02:00 committed by GitHub
commit 6a36043231
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 10 additions and 16 deletions

View File

@ -19,7 +19,6 @@
#ifndef INCLUDE_FEATURE_AIS_H_
#define INCLUDE_FEATURE_AIS_H_
#include <QThread>
#include <QNetworkRequest>
#include <QSet>

View File

@ -19,7 +19,6 @@
#ifndef INCLUDE_FEATURE_ANTENNATOOLS_H_
#define INCLUDE_FEATURE_ANTENNATOOLS_H_
#include <QThread>
#include <QHash>
#include <QNetworkRequest>
#include <QTimer>
@ -98,7 +97,6 @@ public:
static const char* const m_featureId;
private:
QThread m_thread;
AntennaToolsSettings m_settings;
QNetworkAccessManager *m_networkManager;

View File

@ -89,7 +89,7 @@ APRS::~APRS()
void APRS::start()
{
qDebug("APRS::start");
m_thread = new QThread(this);
m_thread = new QThread();
m_worker = new APRSWorker(this, m_webAPIAdapterInterface);
m_worker->moveToThread(m_thread);

View File

@ -51,6 +51,7 @@ APRSWorker::APRSWorker(APRS *aprs, WebAPIAdapterInterface *webAPIAdapterInterfac
APRSWorker::~APRSWorker()
{
stopWork();
m_inputMessageQueue.clear();
}
@ -59,7 +60,6 @@ void APRSWorker::startWork()
qDebug("APRSWorker::startWork");
QMutexLocker mutexLocker(&m_mutex);
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
connect(thread(), SIGNAL(finished()), this, SLOT(stopWork()));
// Handle any messages already on the queue
handleInputMessages();
}

View File

@ -131,7 +131,7 @@ void GS232Controller::start()
{
qDebug("GS232Controller::start");
m_thread = new QThread(this);
m_thread = new QThread();
m_worker = new GS232ControllerWorker();
m_worker->moveToThread(m_thread);
QObject::connect(m_thread, &QThread::started, m_worker, &GS232ControllerWorker::startWork);

View File

@ -48,6 +48,7 @@ GS232ControllerWorker::GS232ControllerWorker() :
GS232ControllerWorker::~GS232ControllerWorker()
{
qDebug() << "GS232ControllerWorker::~GS232ControllerWorker";
stopWork();
m_inputMessageQueue.clear();
}
@ -55,7 +56,6 @@ void GS232ControllerWorker::startWork()
{
qDebug() << "GS232ControllerWorker::startWork";
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
connect(thread(), SIGNAL(finished()), this, SLOT(stopWork()));
connect(&m_serialPort, &QSerialPort::readyRead, this, &GS232ControllerWorker::readData);
connect(&m_socket, &QTcpSocket::readyRead, this, &GS232ControllerWorker::readData);
if (m_settings.m_connection == GS232ControllerSettings::TCP) {

View File

@ -19,7 +19,6 @@
#ifndef INCLUDE_FEATURE_MAP_H_
#define INCLUDE_FEATURE_MAP_H_
#include <QThread>
#include <QHash>
#include <QNetworkRequest>
#include <QDateTime>
@ -171,7 +170,6 @@ public:
static const char* const m_featureId;
private:
QThread m_thread;
MapSettings m_settings;
QHash<QObject*, MapSettings::AvailableChannelOrFeature> m_availableChannelOrFeatures;

View File

@ -81,7 +81,7 @@ void PERTester::start()
{
qDebug("PERTester::start");
m_thread = new QThread(this);
m_thread = new QThread();
m_worker = new PERTesterWorker();
m_worker->moveToThread(m_thread);

View File

@ -51,6 +51,7 @@ PERTesterWorker::PERTesterWorker() :
PERTesterWorker::~PERTesterWorker()
{
stopWork();
closeUDP();
disconnect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
m_inputMessageQueue.clear();
@ -65,7 +66,6 @@ void PERTesterWorker::startWork()
if (m_tx >= m_settings.m_packetCount)
resetStats();
connect(&m_txTimer, SIGNAL(timeout()), this, SLOT(tx()));
connect(thread(), SIGNAL(finished()), this, SLOT(stopWork()));
m_txTimer.start(m_settings.m_interval * 1000.0);
// Handle any messages already on the queue
handleInputMessages();

View File

@ -19,7 +19,6 @@
#ifndef INCLUDE_FEATURE_RADIOSONDE_H_
#define INCLUDE_FEATURE_RADIOSONDE_H_
#include <QThread>
#include <QNetworkRequest>
#include <QSet>

View File

@ -88,7 +88,7 @@ void SatelliteTracker::start()
FeatureWebAPIUtils::mapSetDateTime(currentDateTime());
}
m_thread = new QThread(this);
m_thread = new QThread();
m_worker = new SatelliteTrackerWorker(this, m_webAPIAdapterInterface);
m_worker->moveToThread(m_thread);

View File

@ -66,6 +66,7 @@ SatelliteTrackerWorker::SatelliteTrackerWorker(SatelliteTracker* satelliteTracke
SatelliteTrackerWorker::~SatelliteTrackerWorker()
{
qDebug() << "SatelliteTrackerWorker::~SatelliteTrackerWorker";
stopWork();
m_inputMessageQueue.clear();
}
@ -74,7 +75,6 @@ void SatelliteTrackerWorker::startWork()
qDebug() << "SatelliteTrackerWorker::startWork";
QMutexLocker mutexLocker(&m_mutex);
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
connect(thread(), SIGNAL(finished()), this, SLOT(stopWork()));
m_recalculatePasses = true;
m_pollTimer.start((int)round(m_settings.m_updatePeriod*1000.0));

View File

@ -107,7 +107,7 @@ void StarTracker::start()
{
qDebug("StarTracker::start");
m_thread = new QThread(this);
m_thread = new QThread();
m_worker = new StarTrackerWorker(this, m_webAPIAdapterInterface);
m_worker->moveToThread(m_thread);

View File

@ -60,6 +60,7 @@ StarTrackerWorker::StarTrackerWorker(StarTracker* starTracker, WebAPIAdapterInte
StarTrackerWorker::~StarTrackerWorker()
{
stopWork();
m_inputMessageQueue.clear();
}
@ -67,7 +68,6 @@ void StarTrackerWorker::startWork()
{
QMutexLocker mutexLocker(&m_mutex);
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
connect(thread(), SIGNAL(finished()), this, SLOT(stopWork()));
m_pollTimer.start((int)round(m_settings.m_updatePeriod*1000.0));
// Handle any messages already on the queue
handleInputMessages();