1ee4d83dfSVishwanatha Subbanna #pragma once 2ee4d83dfSVishwanatha Subbanna 3ee4d83dfSVishwanatha Subbanna #include <systemd/sd-event.h> 47db89e36SBrad Bishop 57db89e36SBrad Bishop #include <memory> 6ee4d83dfSVishwanatha Subbanna namespace open_power 7ee4d83dfSVishwanatha Subbanna { 8ee4d83dfSVishwanatha Subbanna namespace occ 9ee4d83dfSVishwanatha Subbanna { 10ee4d83dfSVishwanatha Subbanna 11ee4d83dfSVishwanatha Subbanna /* Need a custom deleter for freeing up sd_event */ 12ee4d83dfSVishwanatha Subbanna struct EventDeleter 13ee4d83dfSVishwanatha Subbanna { operator ()open_power::occ::EventDeleter14ee4d83dfSVishwanatha Subbanna void operator()(sd_event* event) const 15ee4d83dfSVishwanatha Subbanna { 16*f3a4a69fSGeorge Liu sd_event_unref(event); 17ee4d83dfSVishwanatha Subbanna } 18ee4d83dfSVishwanatha Subbanna }; 19ee4d83dfSVishwanatha Subbanna using EventPtr = std::unique_ptr<sd_event, EventDeleter>; 20ee4d83dfSVishwanatha Subbanna 21ee4d83dfSVishwanatha Subbanna /* Need a custom deleter for freeing up sd_event_source */ 22ee4d83dfSVishwanatha Subbanna struct EventSourceDeleter 23ee4d83dfSVishwanatha Subbanna { operator ()open_power::occ::EventSourceDeleter24ee4d83dfSVishwanatha Subbanna void operator()(sd_event_source* eventSource) const 25ee4d83dfSVishwanatha Subbanna { 26*f3a4a69fSGeorge Liu sd_event_source_unref(eventSource); 27ee4d83dfSVishwanatha Subbanna } 28ee4d83dfSVishwanatha Subbanna }; 29ee4d83dfSVishwanatha Subbanna using EventSourcePtr = std::unique_ptr<sd_event_source, EventSourceDeleter>; 30ee4d83dfSVishwanatha Subbanna 31ee4d83dfSVishwanatha Subbanna } // namespace occ 32ee4d83dfSVishwanatha Subbanna } // namespace open_power 33