Program Listing for File SyncSignalWrapper.hpp
↰ Return to documentation for file (BackendLibfabric/SyncSignalWrapper.hpp)
#ifndef NETIO3BACKEND_BACKENDLIBFABRIC_SYNCSIGNALWRAPPER_HPP
#define NETIO3BACKEND_BACKENDLIBFABRIC_SYNCSIGNALWRAPPER_HPP
#include <atomic>
#include <memory>
#include "netio3-backend/EventLoop/EventSignalHandle.hpp"
#include "netio3-backend/EventLoop/BaseEventLoop.hpp"
namespace netio3::libfabric {
class SyncSignalWrapper
{
public:
explicit SyncSignalWrapper(BaseEventLoop* event_loop,
std::function<void()> cb,
bool use_semaphore);
~SyncSignalWrapper();
SyncSignalWrapper(const SyncSignalWrapper&) = delete;
SyncSignalWrapper(SyncSignalWrapper&&) = delete;
SyncSignalWrapper& operator=(const SyncSignalWrapper&) = delete;
SyncSignalWrapper& operator=(SyncSignalWrapper&&) = delete;
void fire() const;
private:
void on_unregistered();
BaseEventLoop* m_event_loop;
std::unique_ptr<EventSignalHandle> m_signal;
std::atomic_bool m_unregistered{false};
};
} // namespace netio3::libfabric
#endif // NETIO3BACKEND_BACKENDLIBFABRIC_SYNCSIGNALWRAPPER_HPP