Vishwanatha Subbanna | ee4d83d | 2017-06-29 18:35:00 +0530 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <systemd/sd-event.h> |
Brad Bishop | 7db89e3 | 2018-10-18 16:42:03 -0400 | [diff] [blame] | 4 | |
| 5 | #include <memory> |
Vishwanatha Subbanna | ee4d83d | 2017-06-29 18:35:00 +0530 | [diff] [blame] | 6 | namespace open_power |
| 7 | { |
| 8 | namespace occ |
| 9 | { |
| 10 | |
| 11 | /* Need a custom deleter for freeing up sd_event */ |
| 12 | struct EventDeleter |
| 13 | { |
| 14 | void operator()(sd_event* event) const |
| 15 | { |
| 16 | event = sd_event_unref(event); |
| 17 | } |
| 18 | }; |
| 19 | using EventPtr = std::unique_ptr<sd_event, EventDeleter>; |
| 20 | |
| 21 | /* Need a custom deleter for freeing up sd_event_source */ |
| 22 | struct EventSourceDeleter |
| 23 | { |
| 24 | void operator()(sd_event_source* eventSource) const |
| 25 | { |
| 26 | eventSource = sd_event_source_unref(eventSource); |
| 27 | } |
| 28 | }; |
| 29 | using EventSourcePtr = std::unique_ptr<sd_event_source, EventSourceDeleter>; |
| 30 | |
| 31 | } // namespace occ |
| 32 | } // namespace open_power |