DevReattacher: Spinlock-protect stop() call

Replace the current delay timeout mechanism with a spinlock.
Both mechanisms try to eliminate the possibility of an in-flight
async op accessing state that has been destroyed by stop().

But the spinlock is less arbitrary.
This commit is contained in:
2025-11-27 22:52:09 -04:00
parent 1e76d51c41
commit 2a8d320f7a
2 changed files with 12 additions and 24 deletions
@@ -5,6 +5,7 @@
#include <atomic>
#include <memory>
#include <boost/asio/deadline_timer.hpp>
#include <spinLock.h>
namespace smo {
@@ -35,7 +36,8 @@ private:
DeviceManager &parent;
std::shared_ptr<ComponentThread> ioThread;
std::atomic<bool> shouldContinue;
SpinLock shouldContinueLock;
bool shouldContinue;
boost::asio::deadline_timer timer;
};