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 | { |
George Liu | f3a4a69 | 2021-12-28 13:59:51 +0800 | [diff] [blame] | 16 | sd_event_unref(event); |
Vishwanatha Subbanna | ee4d83d | 2017-06-29 18:35:00 +0530 | [diff] [blame] | 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 | { |
George Liu | f3a4a69 | 2021-12-28 13:59:51 +0800 | [diff] [blame] | 26 | sd_event_source_unref(eventSource); |
Vishwanatha Subbanna | ee4d83d | 2017-06-29 18:35:00 +0530 | [diff] [blame] | 27 | } |
| 28 | }; |
| 29 | using EventSourcePtr = std::unique_ptr<sd_event_source, EventSourceDeleter>; |
| 30 | |
| 31 | } // namespace occ |
| 32 | } // namespace open_power |