summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWilliam A. Kennington III <wak@google.com>2018-09-25 15:18:14 -0700
committerWilliam A. Kennington III <wak@google.com>2018-09-25 15:47:47 -0700
commit4755818efb01787b7098bd17946fa85686aeeee5 (patch)
tree925d1799788f7753aa57f9a964682e1e58fae623 /src
parent2923d1746df152e920dcbfcf7214cfb6dd1b65c1 (diff)
downloadsdeventplus-4755818efb01787b7098bd17946fa85686aeeee5.tar.gz
sdeventplus-4755818efb01787b7098bd17946fa85686aeeee5.zip
utility/timer: Callback should pass in the timer
This makes the timer better resemble the other source types, and makes it easier to access timer properties from the callback. Since we do not yet have any committed users of this API it is safe to change it. Tested: Unit tests were run and builds work fine. Change-Id: I9ecb24a20bc822b2ab55900e47a7cae834ba873d Signed-off-by: William A. Kennington III <wak@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/sdeventplus/utility/timer.cpp2
-rw-r--r--src/sdeventplus/utility/timer.hpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/sdeventplus/utility/timer.cpp b/src/sdeventplus/utility/timer.cpp
index 6ad684c..7c75e07 100644
--- a/src/sdeventplus/utility/timer.cpp
+++ b/src/sdeventplus/utility/timer.cpp
@@ -102,7 +102,7 @@ void Timer<Id>::internalCallback(source::Time<Id>&,
expired = true;
if (callback)
{
- callback();
+ callback(*this);
}
resetRemaining();
}
diff --git a/src/sdeventplus/utility/timer.hpp b/src/sdeventplus/utility/timer.hpp
index a9d4fbc..8865ba1 100644
--- a/src/sdeventplus/utility/timer.hpp
+++ b/src/sdeventplus/utility/timer.hpp
@@ -31,7 +31,7 @@ class Timer
/** @brief Type of the user provided callback function when the
* timer elapses.
*/
- using Callback = std::function<void()>;
+ using Callback = std::function<void(Timer<Id>&)>;
Timer(const Timer& other) = delete;
Timer(Timer&& other) = default;
OpenPOWER on IntegriCloud