Files
salmanoff/smocore/include/deviceManager/deviceReattacher.h
T
hayodea 93103aa8d4 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.
2025-09-28 23:07:39 -04:00

45 lines
892 B
C++

#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