diff --git a/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/custom_publisher_info.hpp b/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/custom_publisher_info.hpp index 3e7282fa1..f3c3b3542 100644 --- a/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/custom_publisher_info.hpp +++ b/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/custom_publisher_info.hpp @@ -123,26 +123,22 @@ class PubListener : public EventListenerInterface, public eprosima::fastdds::dds private: CustomPublisherInfo * publisher_info_ = nullptr; - std::set subscriptions_ - RCPPUTILS_TSA_GUARDED_BY( - discovery_m_); + mutable std::mutex discovery_m_; - std::mutex discovery_m_; + std::set subscriptions_ + RCPPUTILS_TSA_GUARDED_BY(discovery_m_); - bool deadline_changes_; + std::atomic_bool deadline_changes_; eprosima::fastdds::dds::OfferedDeadlineMissedStatus offered_deadline_missed_status_ - RCPPUTILS_TSA_GUARDED_BY( - on_new_event_m_); + RCPPUTILS_TSA_GUARDED_BY(on_new_event_m_); - bool liveliness_changes_; + std::atomic_bool liveliness_changes_; eprosima::fastdds::dds::LivelinessLostStatus liveliness_lost_status_ - RCPPUTILS_TSA_GUARDED_BY( - on_new_event_m_); + RCPPUTILS_TSA_GUARDED_BY(on_new_event_m_); - bool incompatible_qos_changes_; + std::atomic_bool incompatible_qos_changes_; eprosima::fastdds::dds::OfferedIncompatibleQosStatus incompatible_qos_status_ - RCPPUTILS_TSA_GUARDED_BY( - on_new_event_m_); + RCPPUTILS_TSA_GUARDED_BY(on_new_event_m_); }; #endif // RMW_FASTRTPS_SHARED_CPP__CUSTOM_PUBLISHER_INFO_HPP_ diff --git a/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/custom_service_info.hpp b/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/custom_service_info.hpp index 4d04c06e4..883a6a7ad 100644 --- a/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/custom_service_info.hpp +++ b/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/custom_service_info.hpp @@ -177,10 +177,8 @@ class ServicePubListener : public eprosima::fastdds::dds::DataWriterListener private: std::mutex mutex_; - subscriptions_set_t subscriptions_ RCPPUTILS_TSA_GUARDED_BY( - mutex_); - clients_endpoints_map_t clients_endpoints_ RCPPUTILS_TSA_GUARDED_BY( - mutex_); + subscriptions_set_t subscriptions_ RCPPUTILS_TSA_GUARDED_BY(mutex_); + clients_endpoints_map_t clients_endpoints_ RCPPUTILS_TSA_GUARDED_BY(mutex_); std::condition_variable cv_; }; diff --git a/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/custom_subscriber_info.hpp b/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/custom_subscriber_info.hpp index 3945c3fe2..f57daeb0f 100644 --- a/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/custom_subscriber_info.hpp +++ b/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/custom_subscriber_info.hpp @@ -169,28 +169,24 @@ class SubListener : public EventListenerInterface, public eprosima::fastdds::dds private: CustomSubscriberInfo * subscriber_info_ = nullptr; - bool deadline_changes_; + std::atomic_bool deadline_changes_; eprosima::fastdds::dds::RequestedDeadlineMissedStatus requested_deadline_missed_status_ - RCPPUTILS_TSA_GUARDED_BY( - on_new_event_m_); + RCPPUTILS_TSA_GUARDED_BY(on_new_event_m_); - bool liveliness_changes_; + std::atomic_bool liveliness_changes_; eprosima::fastdds::dds::LivelinessChangedStatus liveliness_changed_status_ - RCPPUTILS_TSA_GUARDED_BY( - on_new_event_m_); + RCPPUTILS_TSA_GUARDED_BY(on_new_event_m_); - bool sample_lost_changes_; + std::atomic_bool sample_lost_changes_; eprosima::fastdds::dds::SampleLostStatus sample_lost_status_ - RCPPUTILS_TSA_GUARDED_BY( - on_new_event_m_); + RCPPUTILS_TSA_GUARDED_BY(on_new_event_m_); - bool incompatible_qos_changes_; + std::atomic_bool incompatible_qos_changes_; eprosima::fastdds::dds::RequestedIncompatibleQosStatus incompatible_qos_status_ - RCPPUTILS_TSA_GUARDED_BY( - discovery_m_); + RCPPUTILS_TSA_GUARDED_BY(discovery_m_); std::set publishers_ RCPPUTILS_TSA_GUARDED_BY( - internalMutex_); + discovery_m_); rmw_event_callback_t on_new_message_cb_{nullptr}; diff --git a/rmw_fastrtps_shared_cpp/src/rmw_take.cpp b/rmw_fastrtps_shared_cpp/src/rmw_take.cpp index 89ba122ce..c03d46b36 100644 --- a/rmw_fastrtps_shared_cpp/src/rmw_take.cpp +++ b/rmw_fastrtps_shared_cpp/src/rmw_take.cpp @@ -438,8 +438,7 @@ struct LoanManager private: std::mutex mtx; using ItemVector = eprosima::fastrtps::ResourceLimitedVector>; - ItemVector items RCPPUTILS_TSA_GUARDED_BY( - mtx); + ItemVector items RCPPUTILS_TSA_GUARDED_BY(mtx); }; void