Skip to content

Commit

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

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>

* Refs #19702: reviewer suggestion

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>

---------

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>
(cherry picked from commit 8126a51)

Co-authored-by: Mario Domínguez López <116071334+Mario-DL@users.noreply.github.com>
  • Loading branch information
mergify[bot] and Mario-DL authored Nov 13, 2023
1 parent 3c0d443 commit 26dafe7
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 @@ -1079,6 +1079,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 26dafe7

Please sign in to comment.