blob: 26318e849d0cc50527d4e8c898224dc051355e19 [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 {
16 event = sd_event_unref(event);
17 }
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 {
26 eventSource = sd_event_source_unref(eventSource);
27 }
28};
29using EventSourcePtr = std::unique_ptr<sd_event_source, EventSourceDeleter>;
30
31} // namespace occ
32} // namespace open_power