Files
salmanoff/smocore/include/deviceManager/deviceReattacher.h
T
hayodea 5845f1a41d Bug:Boost: Use shlibs instead of header-only for call_stack::top_
This symbol is defined as a static member object inside of a
boost detail header. When boost headers are used in a project
that uses Boost in both the main binary as well as dlopen()'d
shlibs, the top_ symbol gets duplicated and the metadata gets
partitioned.

We use the Boost shlib to unify both the main binary and the
shlibs to use the same memory address for top_.

This involves marking the templated object call_stack::top_ as
"extern" and then declaring to Boost that we intend to use the
shlibs.
2025-11-03 22:59:52 -04:00

46 lines
940 B
C++

#ifndef DEVICEREATTACHER_H
#define DEVICEREATTACHER_H
#include <boostAsioLinkageFix.h>
#include <atomic>
#include <memory>
#include <boost/asio/deadline_timer.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