Skip to content

Commit

Permalink
Added missing protection during liveliness assertion (#2801)
Browse files Browse the repository at this point in the history
* Added missing pretection during assert_liveliness

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>

* Changed unique_locks to lock_guards where applicable to our issue to clarify intent

Signed-off-by: Javier Santiago <javiersantiago@eprosima.com>
(cherry picked from commit 275fb3d)
  • Loading branch information
jsan-rt authored and mergify[bot] committed Jul 6, 2022
1 parent 2edded2 commit 8574997
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/cpp/rtps/writer/LivelinessManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ bool LivelinessManager::assert_liveliness(
return false;
}

std::lock_guard<std::mutex> lock(mutex_);

if (timer_owner_ != nullptr)
{
// Some times the interval could be negative if a writer expired during the call to this function
Expand Down Expand Up @@ -270,7 +272,7 @@ bool LivelinessManager::assert_liveliness(
return false;
}

std::unique_lock<std::mutex> lock(mutex_);
std::lock_guard<std::mutex> lock(mutex_);

if (timer_owner_ != nullptr)
{
Expand Down

0 comments on commit 8574997

Please sign in to comment.