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:
@@ -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
|
||||
Reference in New Issue
Block a user