Skip to content

Commit

Permalink
Refs #16192. Fix deadlock on WaitSetImpl.
Browse files Browse the repository at this point in the history
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
  • Loading branch information
MiguelCompany authored Nov 16, 2022
1 parent 764823a commit 8c60364
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/cpp/fastdds/core/condition/WaitSetImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,16 @@ namespace detail {

WaitSetImpl::~WaitSetImpl()
{
std::lock_guard<std::mutex> guard(mutex_);
for (const Condition* c : entries_)
eprosima::utilities::collections::unordered_vector<const Condition*> old_entries;

{
// We only need to protect access to the collection.
std::lock_guard<std::mutex> guard(mutex_);
old_entries = entries_;
entries_.clear();
}

for (const Condition* c : old_entries)
{
c->get_notifier()->detach_from(this);
}
Expand Down

0 comments on commit 8c60364

Please sign in to comment.