Skip to content

Commit

Permalink
Fix Data Race when updating liveliness changed in WLP (#3926) (#3959)
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)

Co-authored-by: Mario Domínguez López <[email protected]>
  • Loading branch information
mergify[bot] and Mario-DL authored Nov 13, 2023
1 parent 4ab9cc5 commit 0a9447f
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 0a9447f

Please sign in to comment.