Skip to content

Commit

Permalink
Workaround for false positive findings by clang thread safety analysi…
Browse files Browse the repository at this point in the history
…s in time controller jump callbacks API. (#799)

Moved cv.notify_all() inside mutex lock scope, also made method process_callback() as non-static

Signed-off-by: Michael Orlov <michael.orlov@apex.ai>
  • Loading branch information
MichaelOrlov committed Jun 30, 2021
1 parent 252e241 commit 3bc6896
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions rosbag2_cpp/src/rosbag2_cpp/clocks/time_controller_clock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ class TimeControllerClockImpl
{
std::lock_guard<std::mutex> lock(state_mutex);
snapshot(ros_time);
cv.notify_all();
}
process_callbacks_after_jump(time_jump);
cv.notify_all();
}

/**
Expand Down Expand Up @@ -211,9 +211,9 @@ class TimeControllerClockImpl
}
}

static void process_callback(
void process_callback(
PlayerClock::JumpHandler::SharedPtr handler, const rcl_time_jump_t & time_jump,
bool before_jump) RCPPUTILS_TSA_REQUIRES(callback_list_mutex_)
bool before_jump) const RCPPUTILS_TSA_REQUIRES(callback_list_mutex_)
{
bool is_clock_change = time_jump.clock_change == RCL_ROS_TIME_ACTIVATED ||
time_jump.clock_change == RCL_ROS_TIME_DEACTIVATED;
Expand Down

0 comments on commit 3bc6896

Please sign in to comment.