Skip to content
This repository has been archived by the owner on Apr 14, 2024. It is now read-only.

Commit

Permalink
Stop thread if still running in destructor
Browse files Browse the repository at this point in the history
Threads addressed in this commit:
 - Transmitter (txThread, txStats)
 - Capturer
 - EmulXcvr
  • Loading branch information
pstavirs committed Nov 24, 2023
1 parent cf84060 commit f185ceb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 5 additions & 2 deletions server/pcapport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,8 @@ PcapPort::PortCapturer::PortCapturer(const char *device)

PcapPort::PortCapturer::~PortCapturer()
{
if (isRunning())
stop();
capFile_.close();
}

Expand Down Expand Up @@ -549,7 +551,8 @@ PcapPort::EmulationTransceiver::EmulationTransceiver(const char *device,

PcapPort::EmulationTransceiver::~EmulationTransceiver()
{
stop();
if (isRunning())
stop();
}

void PcapPort::EmulationTransceiver::run()
Expand Down Expand Up @@ -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;
}
}
Expand Down
4 changes: 4 additions & 0 deletions server/pcaptransmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ PcapTransmitter::PcapTransmitter(

PcapTransmitter::~PcapTransmitter()
{
if (txThread_.isRunning())
txThread_.stop();
if (txStats_.isRunning())
txStats_.stop();
}

bool PcapTransmitter::setRateAccuracy(
Expand Down

0 comments on commit f185ceb

Please sign in to comment.