MCPcopy Create free account
hub / github.com/BehaviorTree/BehaviorTree.CPP / ~Groot2Publisher

Method ~Groot2Publisher

src/loggers/groot2_publisher.cpp:168–198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166}
167
168Groot2Publisher::~Groot2Publisher()
169{
170 // First, signal threads to stop
171 _p->active_server = false;
172
173 // Shutdown the ZMQ context to unblock any recv() calls immediately.
174 // This prevents waiting for the recv timeout (100ms) before threads can exit.
175 // Context shutdown will cause all blocking operations to return with ETERM error.
176 _p->context.shutdown();
177
178 // Now join the threads - they should exit quickly
179 if(_p->server_thread.joinable())
180 {
181 _p->server_thread.join();
182 }
183
184 if(_p->heartbeat_thread.joinable())
185 {
186 _p->heartbeat_thread.join();
187 }
188
189 // Remove hooks after threads are stopped to avoid race conditions
190 removeAllHooks();
191
192 flush();
193
194 // Explicitly close sockets before context is destroyed.
195 // This ensures proper cleanup on all platforms, especially Windows.
196 _p->server.close();
197 _p->publisher.close();
198}
199
200void Groot2Publisher::callback(Duration ts, const TreeNode& node, NodeStatus prev_status,
201 NodeStatus new_status)

Callers

nothing calls this directly

Calls 1

closeMethod · 0.80

Tested by

no test coverage detected