MCPcopy Create free account
hub / github.com/BehaviorTree/BehaviorTree.CPP / run

Method run

include/behaviortree_cpp/utils/timer_queue.h:185–210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

183
184private:
185 void run()
186 {
187 while(!m_finish.load())
188 {
189 auto end = calcWaitTime();
190 if(end.first)
191 {
192 // Timers found, so wait until it expires (or something else
193 // changes)
194 m_checkWork.waitUntil(end.second);
195 }
196 else
197 {
198 // No timers exist, so wait an arbitrary amount of time
199 m_checkWork.waitUntil(ClockT::now() + std::chrono::milliseconds(10));
200 }
201
202 // Check and execute as much work as possible, such as, all expired
203 // timers
204 checkWork();
205 }
206
207 // If we are shutting down, we should not have any items left,
208 // since the shutdown cancels all items
209 assert(m_items.size() == 0);
210 }
211
212 std::pair<bool, std::chrono::time_point<ClockT, DurationT>> calcWaitTime()
213 {

Callers

nothing calls this directly

Calls 3

waitUntilMethod · 0.80
loadMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected