Skip to content

Commit

Permalink
Fix dataraces when creating DataWriters (#3008)
Browse files Browse the repository at this point in the history
* Refs #15905: Declare the PublishMode running flag as atomic

Signed-off-by: Eduardo Ponz <eduardoponz@eprosima.com>

* Refs #15905: Add RTPS regression test

Signed-off-by: Eduardo Ponz <eduardoponz@eprosima.com>

* Refs #15905: Add DomainParticipantImpl::create_instance_handle data race regression test

Signed-off-by: Eduardo Ponz <eduardoponz@eprosima.com>

* Refs #15905: Set DomainParticipantImpl::next_instance_id_ as atomic

Signed-off-by: Eduardo Ponz <eduardoponz@eprosima.com>

* Refs #15905: Apply suggestions

Signed-off-by: Eduardo Ponz <eduardoponz@eprosima.com>

Signed-off-by: Eduardo Ponz <eduardoponz@eprosima.com>
(cherry picked from commit 4391864)

# Conflicts:
#	src/cpp/rtps/flowcontrol/FlowControllerImpl.hpp
#	test/blackbox/common/DDSBlackboxTestsBasic.cpp
#	test/blackbox/common/RTPSBlackboxTestsBasic.cpp
  • Loading branch information
EduPonz authored and mergify[bot] committed Oct 14, 2022
1 parent 5b86ab1 commit ba15cd3
Show file tree
Hide file tree
Showing 5 changed files with 1,925 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/cpp/fastdds/domain/DomainParticipantImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1805,12 +1805,12 @@ void DomainParticipantImpl::create_instance_handle(
{
using eprosima::fastrtps::rtps::octet;

++next_instance_id_;
uint32_t id = ++next_instance_id_;
handle = guid_;
handle.value[15] = 0x01; // Vendor specific;
handle.value[14] = static_cast<octet>(next_instance_id_ & 0xFF);
handle.value[13] = static_cast<octet>((next_instance_id_ >> 8) & 0xFF);
handle.value[12] = static_cast<octet>((next_instance_id_ >> 16) & 0xFF);
handle.value[14] = static_cast<octet>(id & 0xFF);
handle.value[13] = static_cast<octet>((id >> 8) & 0xFF);
handle.value[12] = static_cast<octet>((id >> 16) & 0xFF);
}

DomainParticipantListener* DomainParticipantImpl::get_listener_for(
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/fastdds/domain/DomainParticipantImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ class DomainParticipantImpl
fastrtps::rtps::GUID_t guid_;

//!For instance handle creation
uint32_t next_instance_id_;
std::atomic<uint32_t> next_instance_id_;

//!Participant Qos
DomainParticipantQos qos_;
Expand Down
Loading

0 comments on commit ba15cd3

Please sign in to comment.