File tree 1 file changed +5
-1
lines changed
1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ std::thread g_deferred_signal_handling_thread;
57
57
58
58
// relying on python GIL for safety
59
59
std::atomic<bool > g_signal_handler_installed = false ;
60
+ std::atomic<bool > g_is_sigterm;
60
61
61
62
void
62
63
notify_signal_handler () noexcept
@@ -140,7 +141,9 @@ setup_deferred_signal_handler()
140
141
wait_for_signal ();
141
142
if (g_signal_handler_installed.load ()) {
142
143
trigger_guard_conditions ();
143
- rclpy::shutdown_contexts ();
144
+ if (g_is_sigterm.exchange (false )) {
145
+ rclpy::shutdown_contexts ();
146
+ }
144
147
}
145
148
}
146
149
});
@@ -325,6 +328,7 @@ DEFINE_SIGNAL_HANDLER(rclpy_sigterm_handler)
325
328
// Try to unregister again.
326
329
unregister_sigint_signal_handler ();
327
330
} else {
331
+ g_is_sigterm.exchange (true );
328
332
notify_signal_handler ();
329
333
}
330
334
}
You can’t perform that action at this time.
0 commit comments