Skip to content

Commit 0c06414

Browse files
committed
fix: dirty
1 parent d9a29f2 commit 0c06414

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

callback_isolated_executor/src/component_container_callback_isolated.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class ComponentManagerCallbackIsolated
5151
node_id_to_executor_wrappers_;
5252
rclcpp::Publisher<cie_config_msgs::msg::CallbackGroupInfo>::SharedPtr
5353
client_publisher_;
54+
std::mutex client_publisher_mutex_;
5455
};
5556

5657
ComponentManagerCallbackIsolated::~ComponentManagerCallbackIsolated() {
@@ -141,11 +142,10 @@ void ComponentManagerCallbackIsolated::add_node_to_executor(uint64_t node_id) {
141142
std::thread([&executor_wrapper, group_id, this]() {
142143
auto tid = syscall(SYS_gettid);
143144

144-
// dirty
145-
for (int i = 0; i < 3; i++) {
146-
std::this_thread::sleep_for(std::chrono::milliseconds(100));
145+
{
146+
std::lock_guard<std::mutex> lock(this->client_publisher_mutex_);
147147
cie_thread_configurator::publish_callback_group_info(
148-
this->client_publisher_, tid, group_id);
148+
this->client_publisher_, tid, group_id);
149149
}
150150

151151
executor_wrapper.thread_initialized = true;

0 commit comments

Comments
 (0)