path: root/control
diff options
authorWilliam A. Kennington III <>2018-10-30 19:50:57 -0700
committerWilliam A. Kennington III <>2018-11-05 11:49:15 -0800
commit22c36ab6b4c1b42a12958d6c88452d039a28b6f8 (patch)
treedf36483efa62cd5a15dcd1263b468e6530b6d514 /control
parentc0c5f07f38820184cde4ce5bf55ddaee94fc4199 (diff)
Prefer bind over method call in lambda
This reduces a layer of indirection since the function can be called directly instead of indirectly accessing it with the lambda. It also makes the instantiation more flexible since it can match callbacks with extra arguments. Tested: Built and run through unit tests. Change-Id: I5317203fa70c027c5e774ed6192952058e35bd81 Signed-off-by: William A. Kennington III <>
Diffstat (limited to 'control')
1 files changed, 3 insertions, 2 deletions
diff --git a/control/zone.cpp b/control/zone.cpp
index 1ca0465..17ec5fc 100644
--- a/control/zone.cpp
+++ b/control/zone.cpp
@@ -14,6 +14,7 @@
* limitations under the License.
#include <chrono>
+#include <functional>
#include <phosphor-logging/log.hpp>
#include <phosphor-logging/elog.hpp>
#include <phosphor-logging/elog-errors.hpp>
@@ -46,8 +47,8 @@ Zone::Zone(Mode mode,
- _incTimer(event, [this](){ this->incTimerExpired(); }),
- _decTimer(event, [this](){ this->decTimerExpired(); }),
+ _incTimer(event, std::bind(&Zone::incTimerExpired, this)),
+ _decTimer(event, std::bind(&Zone::decTimerExpired, this)),
auto& fanDefs = std::get<fanListPos>(def);
OpenPOWER on IntegriCloud