summaryrefslogtreecommitdiffstats
path: root/timer.hpp
diff options
context:
space:
mode:
authorMatt Spinler <spinler@us.ibm.com>2017-05-11 10:07:55 -0500
committerPatrick Williams <patrick@stwcx.xyz>2017-05-11 19:58:23 +0000
commite824f985e7e32923d9f76e3ad5baf4909880739f (patch)
tree8a89c8fc65f2611101d04ae9c550d4beb707d69d /timer.hpp
parent14321846e57f483f472590b1c5fe35891511312f (diff)
downloadphosphor-fan-presence-e824f985e7e32923d9f76e3ad5baf4909880739f.tar.gz
phosphor-fan-presence-e824f985e7e32923d9f76e3ad5baf4909880739f.zip
Use unique_ptr for sd_event object wrapper
Convert the sd_event object wrapper from a shared_ptr to a unique_ptr. Requires a new header file. Change-Id: I868a9e88ed93878c2e0bb12e58f8d3a604510da0 Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Diffstat (limited to 'timer.hpp')
-rw-r--r--timer.hpp19
1 files changed, 4 insertions, 15 deletions
diff --git a/timer.hpp b/timer.hpp
index ea28176..979a1cc 100644
--- a/timer.hpp
+++ b/timer.hpp
@@ -3,7 +3,7 @@
#include <chrono>
#include <functional>
#include <memory>
-#include <systemd/sd-event.h>
+#include "event.hpp"
namespace phosphor
{
@@ -12,17 +12,6 @@ namespace fan
namespace util
{
-struct EventSourceDeleter
-{
- void operator()(sd_event_source* eventSource) const
- {
- sd_event_source_unref(eventSource);
- }
-};
-
-using EventSourcePtr = std::unique_ptr<sd_event_source, EventSourceDeleter>;
-
-using EventPtr = std::shared_ptr<sd_event>;
/**
* @class Timer
@@ -60,7 +49,7 @@ class Timer
* @param[in] events - sd_event pointer, previously created
* @param[in] callbackFunc - The function to call on timer expiration
*/
- Timer(EventPtr& events,
+ Timer(phosphor::fan::event::EventPtr& events,
std::function<void()> callbackFunc);
/**
@@ -148,12 +137,12 @@ class Timer
/**
* @brief The sd_event structure
*/
- EventPtr timeEvent;
+ phosphor::fan::event::EventPtr& timeEvent;
/**
* @brief Source of events
*/
- EventSourcePtr eventSource;
+ phosphor::fan::event::EventSourcePtr eventSource;
/**
* @brief Either 'repeating' or 'oneshot'
OpenPOWER on IntegriCloud