We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 83c36a4 commit b9bc25cCopy full SHA for b9bc25c
src/tree_node.cpp
@@ -14,6 +14,7 @@
14
#include "behaviortree_cpp/tree_node.h"
15
16
#include <array>
17
+#include <atomic>
18
#include <cstring>
19
20
namespace BT
@@ -104,8 +105,12 @@ NodeStatus TreeNode::executeTick()
104
105
if(!substituted)
106
{
107
using namespace std::chrono;
108
+ // Use atomic_thread_fence to prevent compiler reordering of time measurements.
109
+ // See issue #861 for details.
110
const auto t1 = steady_clock::now();
111
+ std::atomic_thread_fence(std::memory_order_seq_cst);
112
new_status = tick();
113
114
const auto t2 = steady_clock::now();
115
if(monitor_tick)
116
0 commit comments