blob: aa0120cd99d3186a5c435ce7a9a88cc9df3cde12 [file] [log] [blame]
Vishwanatha Subbannaee4d83d2017-06-29 18:35:00 +05301#pragma once
2
3#include <systemd/sd-event.h>
Brad Bishop7db89e32018-10-18 16:42:03 -04004
5#include <memory>
Vishwanatha Subbannaee4d83d2017-06-29 18:35:00 +05306namespace open_power
7{
8namespace occ
9{
10
11/* Need a custom deleter for freeing up sd_event */
12struct EventDeleter
13{
14 void operator()(sd_event* event) const
15 {
George Liuf3a4a692021-12-28 13:59:51 +080016 sd_event_unref(event);
Vishwanatha Subbannaee4d83d2017-06-29 18:35:00 +053017 }
18};
19using EventPtr = std::unique_ptr<sd_event, EventDeleter>;
20
21/* Need a custom deleter for freeing up sd_event_source */
22struct EventSourceDeleter
23{
24 void operator()(sd_event_source* eventSource) const
25 {
George Liuf3a4a692021-12-28 13:59:51 +080026 sd_event_source_unref(eventSource);
Vishwanatha Subbannaee4d83d2017-06-29 18:35:00 +053027 }
28};
29using EventSourcePtr = std::unique_ptr<sd_event_source, EventSourceDeleter>;
30
31} // namespace occ
32} // namespace open_power