Fix lock-order-inversion (potential deadlock) (#1135)
Signed-off-by: Tomoya.Fujita <Tomoya.Fujita@sony.com>
This commit is contained in:
parent
eff11d61bb
commit
e3abe8bf7f
1 changed files with 5 additions and 3 deletions
|
@ -368,9 +368,11 @@ rclcpp::Event::SharedPtr
|
||||||
NodeGraph::get_graph_event()
|
NodeGraph::get_graph_event()
|
||||||
{
|
{
|
||||||
auto event = rclcpp::Event::make_shared();
|
auto event = rclcpp::Event::make_shared();
|
||||||
|
{
|
||||||
std::lock_guard<std::mutex> graph_changed_lock(graph_mutex_);
|
std::lock_guard<std::mutex> graph_changed_lock(graph_mutex_);
|
||||||
graph_events_.push_back(event);
|
graph_events_.push_back(event);
|
||||||
graph_users_count_++;
|
graph_users_count_++;
|
||||||
|
}
|
||||||
// on first call, add node to graph_listener_
|
// on first call, add node to graph_listener_
|
||||||
if (should_add_to_graph_listener_.exchange(false)) {
|
if (should_add_to_graph_listener_.exchange(false)) {
|
||||||
graph_listener_->add_node(this);
|
graph_listener_->add_node(this);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue