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