Skip to content

Commit

Permalink
Alway join threads
Browse files Browse the repository at this point in the history
  • Loading branch information
Matevz Morato authored and kaichie committed May 15, 2024
1 parent c4fd43d commit be744d6
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions src/device/DeviceBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -573,21 +573,19 @@ void DeviceBase::closeImpl() {
// Stop watchdog first (this resets and waits for link to fall down)
if(watchdogThread.joinable()) watchdogThread.join();

if(!dumpOnly) {
// Stop various threads
timesyncRunning = false;
loggingRunning = false;
profilingRunning = false;

// Then stop timesync
if(timesyncThread.joinable()) timesyncThread.join();
// And at the end stop logging thread
if(loggingThread.joinable()) loggingThread.join();
// And at the end stop profiling thread
if(profilingThread.joinable()) profilingThread.join();
// At the end stop the monitor thread
if(monitorThread.joinable()) monitorThread.join();
}
// Stop various threads
timesyncRunning = false;
loggingRunning = false;
profilingRunning = false;

// Then stop timesync
if(timesyncThread.joinable()) timesyncThread.join();
// And at the end stop logging thread
if(loggingThread.joinable()) loggingThread.join();
// And at the end stop profiling thread
if(profilingThread.joinable()) profilingThread.join();
// At the end stop the monitor thread
if(monitorThread.joinable()) monitorThread.join();

// Close rpcStream
pimpl->rpcStream = nullptr;
Expand Down

0 comments on commit be744d6

Please sign in to comment.