Skip to content

Commit

Permalink
Add a mutex to add_allowed_messages() that takes nesting into account.
Browse files Browse the repository at this point in the history
Signed-off-by: ISP akm <[email protected]>
  • Loading branch information
xygyo77 committed May 14, 2024
1 parent 76c6c87 commit b96f6f8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CARET_trace/include/caret_trace/tracing_controller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ class TracingController
void info(std::string message) const;

std::shared_timed_mutex mutex_;
std::shared_timed_mutex nested_mutex_;
std::string to_node_name(const void * callback);
std::string to_topic_name(const void * callback);

Expand Down
2 changes: 1 addition & 1 deletion CARET_trace/src/tracing_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,7 @@ void TracingController::add_client_handle(const void * client_handle, const void

void TracingController::add_allowed_messages(const void * message, bool is_allowed)
{
// Be sure to call with "mutex_" locked.
std::lock_guard<std::shared_timed_mutex> lock(nested_mutex_);
static const int max_sz = 256;
if (allowed_messages_.size() > max_sz) {
allowed_messages_.clear();
Expand Down

0 comments on commit b96f6f8

Please sign in to comment.