Skip to content

Commit

Permalink
If a waitset can't be immediately cleaned up, skip it instead of waiting
Browse files Browse the repository at this point in the history
  • Loading branch information
rotu committed Mar 20, 2020
1 parent d05fced commit 5f0023a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions rmw_cyclonedds_cpp/src/rmw_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2221,8 +2221,10 @@ static void clean_waitset_caches()
used ... */
std::lock_guard<std::mutex> lock(gcdds.lock);
for (auto && ws : gcdds.waitsets) {
std::lock_guard<std::mutex> lock2(ws->lock);
waitset_detach(ws);
std::unique_lock<std::mutex> lock2(ws->lock, std::try_to_lock);
if (lock2.owns_lock()) {
waitset_detach(ws);
}
}
}

Expand Down

0 comments on commit 5f0023a

Please sign in to comment.