Skip to content

Commit

Permalink
Fix Data Race when updating liveliness changed in WLP (#3926)
Browse files Browse the repository at this point in the history
* Refs #19702: Fix Data Race in WLP

Signed-off-by: Mario Dominguez <[email protected]>

* Refs #19702: reviewer suggestion

Signed-off-by: Mario Dominguez <[email protected]>

---------

Signed-off-by: Mario Dominguez <[email protected]>
(cherry picked from commit 8126a51)
  • Loading branch information
Mario-DL authored and mergify[bot] committed Oct 26, 2023
1 parent 8d1e611 commit c99aa39
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/cpp/rtps/builtin/liveliness/WLP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1089,6 +1089,8 @@ void WLP::update_liveliness_changed_status(
int32_t alive_change,
int32_t not_alive_change)
{
std::lock_guard<RecursiveTimedMutex> lock(reader->getMutex());

reader->liveliness_changed_status_.alive_count += alive_change;
reader->liveliness_changed_status_.alive_count_change += alive_change;
reader->liveliness_changed_status_.not_alive_count += not_alive_change;
Expand Down

0 comments on commit c99aa39

Please sign in to comment.