Skip to content

Commit

Permalink
fix deadlock
Browse files Browse the repository at this point in the history
  • Loading branch information
facontidavide committed Apr 24, 2024
1 parent 696a27b commit 8abc277
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
14 changes: 8 additions & 6 deletions src/decorators/skip_unless_updated.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,16 @@ NodeStatus SkipUnlessUpdated::tick()
return status;
}

auto entry = config().blackboard->getEntry(entry_key_);
std::unique_lock lk(entry->entry_mutex);
auto seq = static_cast<int64_t>(entry->sequence_id);
if(seq == sequence_id_)
{
return NodeStatus::SKIPPED;
auto entry = config().blackboard->getEntry(entry_key_);
std::unique_lock lk(entry->entry_mutex);
auto seq = static_cast<int64_t>(entry->sequence_id);
if(seq == sequence_id_)
{
return NodeStatus::SKIPPED;
}
sequence_id_ = seq;
}
sequence_id_ = seq;

auto status = child()->executeTick();
still_executing_child_ = (status == NodeStatus::RUNNING);
Expand Down
14 changes: 8 additions & 6 deletions src/decorators/wait_update.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,16 @@ NodeStatus WaitValueUpdate::tick()
return status;
}

auto entry = config().blackboard->getEntry(entry_key_);
std::unique_lock lk(entry->entry_mutex);
auto seq = static_cast<int64_t>(entry->sequence_id);
if(seq == sequence_id_)
{
return NodeStatus::RUNNING;
auto entry = config().blackboard->getEntry(entry_key_);
std::unique_lock lk(entry->entry_mutex);
auto seq = static_cast<int64_t>(entry->sequence_id);
if(seq == sequence_id_)
{
return NodeStatus::SKIPPED;
}
sequence_id_ = seq;
}
sequence_id_ = seq;

auto status = child()->executeTick();
still_executing_child_ = (status == NodeStatus::RUNNING);
Expand Down

0 comments on commit 8abc277

Please sign in to comment.