Stop thread if still running in destructor

Threads addressed in this commit:
 - Transmitter (txThread, txStats)
 - Capturer
 - EmulXcvr
This commit is contained in:
Srivats P 2023-11-24 13:12:35 +05:30
parent cf84060277
commit f185ceb206
2 changed files with 9 additions and 2 deletions

View File

@ -401,6 +401,8 @@ PcapPort::PortCapturer::PortCapturer(const char *device)
PcapPort::PortCapturer::~PortCapturer()
{
if (isRunning())
stop();
capFile_.close();
}
@ -549,6 +551,7 @@ PcapPort::EmulationTransceiver::EmulationTransceiver(const char *device,
PcapPort::EmulationTransceiver::~EmulationTransceiver()
{
if (isRunning())
stop();
}
@ -738,7 +741,7 @@ void PcapPort::EmulationTransceiver::stop()
QThread::msleep(10);
}
else {
qWarning("Receive stop requested but is not running!");
qWarning("Emulation Xcvr stop requested but is not running!");
return;
}
}

View File

@ -34,6 +34,10 @@ PcapTransmitter::PcapTransmitter(
PcapTransmitter::~PcapTransmitter()
{
if (txThread_.isRunning())
txThread_.stop();
if (txStats_.isRunning())
txStats_.stop();
}
bool PcapTransmitter::setRateAccuracy(