From 26fc67721f48255f664743965ae3aa4ce9c383ef Mon Sep 17 00:00:00 2001 From: Aglargil <34728006+Aglargil@users.noreply.github.com> Date: Fri, 6 Sep 2024 16:34:56 +0800 Subject: [PATCH] Update src/tree_node.cpp Co-authored-by: Davide Faconti --- src/tree_node.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/tree_node.cpp b/src/tree_node.cpp index 3b8642f81..6e87acb18 100644 --- a/src/tree_node.cpp +++ b/src/tree_node.cpp @@ -108,7 +108,9 @@ NodeStatus TreeNode::executeTick() using namespace std::chrono; auto t1 = steady_clock::now(); - std::shared_ptr timer(nullptr, [&](...) { + // trick to prevent the compile from reordering the order of execution. See #861 + // This makes sure that the code is executed at the end of this scope + std::shared_ptr execute_later(nullptr, [&](...) { auto t2 = steady_clock::now(); if(monitor_tick) {