summaryrefslogtreecommitdiffstats
path: root/control/zone.cpp
diff options
context:
space:
mode:
authorWilliam A. Kennington III <wak@google.com>2018-10-30 19:11:01 -0700
committerWilliam A. Kennington III <wak@google.com>2018-11-05 11:44:15 -0800
commitc0c5f07f38820184cde4ce5bf55ddaee94fc4199 (patch)
tree79b5cbd8a5e6f803fa317bac985b9fd07176f071 /control/zone.cpp
parent94fe1a0c83ba2d0dadc549b1d8afedf6478d2dcf (diff)
downloadphosphor-fan-presence-c0c5f07f38820184cde4ce5bf55ddaee94fc4199.tar.gz
phosphor-fan-presence-c0c5f07f38820184cde4ce5bf55ddaee94fc4199.zip
control/zone: Reference instead of copying timer data
Tested: Built and ran through unit tests. Change-Id: I9a98d9a3eaee47885b18b642ffd01a38a864dd02 Signed-off-by: William A. Kennington III <wak@google.com>
Diffstat (limited to 'control/zone.cpp')
-rw-r--r--control/zone.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/control/zone.cpp b/control/zone.cpp
index ec0f944..1ca0465 100644
--- a/control/zone.cpp
+++ b/control/zone.cpp
@@ -441,7 +441,10 @@ void Zone::addTimer(const Group& group,
);
auto timer = std::make_unique<util::Timer>(
_eventLoop,
- std::bind(&Zone::timerExpired, this, group, actions)
+ std::bind(&Zone::timerExpired,
+ this,
+ std::cref(std::get<Group>(*data)),
+ std::cref(std::get<std::vector<Action>>(*data)))
);
if (!timer->running())
{
@@ -451,7 +454,8 @@ void Zone::addTimer(const Group& group,
_timerEvents.emplace_back(std::move(data), std::move(timer));
}
-void Zone::timerExpired(Group eventGroup, std::vector<Action> eventActions)
+void Zone::timerExpired(const Group& eventGroup,
+ const std::vector<Action>& eventActions)
{
// Perform the actions
std::for_each(eventActions.begin(),
OpenPOWER on IntegriCloud