DevMgr: Add DeviceReattacher daemon plumbing

This is the plumbing for a periodic polling thread that tries
to reattach DA specs that failed to attach in the startup phase.
This commit is contained in:
2025-09-28 23:07:39 -04:00
parent 2be78401b5
commit 93103aa8d4
5 changed files with 124 additions and 0 deletions
@@ -0,0 +1,44 @@
#ifndef DEVICEREATTACHER_H
#define DEVICEREATTACHER_H
#include <atomic>
#include <memory>
#include <boost/asio.hpp>
namespace smo {
class ComponentThread;
namespace device {
class DeviceManager;
class DeviceReattacher
{
public:
DeviceReattacher(
DeviceManager& parent, std::shared_ptr<ComponentThread> ioThread);
~DeviceReattacher() = default;
// Non-copyable
DeviceReattacher(const DeviceReattacher&) = delete;
DeviceReattacher& operator=(const DeviceReattacher&) = delete;
// Control methods
void start();
void stop();
private:
void scheduleNextTimeout();
void onTimeout(const boost::system::error_code& error);
DeviceManager &parent;
std::shared_ptr<ComponentThread> ioThread;
std::atomic<bool> shouldContinue;
boost::asio::deadline_timer timer;
};
} // namespace device
} // namespace smo
#endif // DEVICEREATTACHER_H