We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c9dea7b commit 1fcb624Copy full SHA for 1fcb624
src/tree_node.cpp
@@ -106,13 +106,19 @@ NodeStatus TreeNode::executeTick()
106
if(!substituted)
107
{
108
using namespace std::chrono;
109
+
110
auto t1 = steady_clock::now();
111
+ // trick to prevent the compile from reordering the order of execution. See #861
112
+ // This makes sure that the code is executed at the end of this scope
113
+ std::shared_ptr<void> execute_later(nullptr, [&](...) {
114
+ auto t2 = steady_clock::now();
115
+ if(monitor_tick)
116
+ {
117
+ monitor_tick(*this, new_status, duration_cast<microseconds>(t2 - t1));
118
+ }
119
+ });
120
121
new_status = tick();
- auto t2 = steady_clock::now();
- if(monitor_tick)
- {
- monitor_tick(*this, new_status, duration_cast<microseconds>(t2 - t1));
- }
122
}
123
124
0 commit comments