Skip to content

Commit

Permalink
Refs #17297: Added underscore
Browse files Browse the repository at this point in the history
Signed-off-by: Javier Santiago <[email protected]>
  • Loading branch information
jsan-rt committed Mar 1, 2023
1 parent c397a94 commit f100853
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
20 changes: 10 additions & 10 deletions examples/cpp/dds/DynamicHelloWorldExample/HelloWorldSubscriber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,14 @@ void HelloWorldSubscriber::SubListener::on_type_discovery(
eprosima::fastrtps::types::DynamicType_ptr dyn_type)
{
std::cout << "Discovered type: " << dyn_type->get_name() << " from topic " << topic_name << std::endl;
received_type = dyn_type;
reception_flag.store(true);
types_cv.notify_one();
received_type_ = dyn_type;
reception_flag_.store(true);
types_cv_.notify_one();
}

void HelloWorldSubscriber::initialize_entities()
{
auto type = m_listener.received_type;
auto type = m_listener.received_type_;
std::cout << "Initializing DDS entities for type: " << type->get_name() << std::endl;
TypeSupport m_type(new eprosima::fastrtps::types::DynamicPubSubType(type));
m_type.register_type(mp_participant);
Expand Down Expand Up @@ -189,10 +189,10 @@ void HelloWorldSubscriber::initialize_entities()
void HelloWorldSubscriber::run()
{
std::cout << "Subscriber running. Please press enter to stop the Subscriber" << std::endl;
std::unique_lock<std::mutex> lock(m_listener.types_mx);
m_listener.types_cv.wait(lock, [&]()
std::unique_lock<std::mutex> lock(m_listener.types_mx_);
m_listener.types_cv_.wait(lock, [&]()
{
return m_listener.reception_flag.exchange(false);
return m_listener.reception_flag_.exchange(false);
});

initialize_entities();
Expand All @@ -204,10 +204,10 @@ void HelloWorldSubscriber::run(
uint32_t number)
{
std::cout << "Subscriber running until " << number << "samples have been received" << std::endl;
std::unique_lock<std::mutex> lock(m_listener.types_mx);
m_listener.types_cv.wait(lock, [&]()
std::unique_lock<std::mutex> lock(m_listener.types_mx_);
m_listener.types_cv_.wait(lock, [&]()
{
return m_listener.reception_flag.exchange(false);
return m_listener.reception_flag_.exchange(false);
});

initialize_entities();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ class HelloWorldSubscriber

uint32_t n_samples;

std::mutex types_mx;
std::mutex types_mx_;

std::condition_variable types_cv;
std::condition_variable types_cv_;

eprosima::fastrtps::types::DynamicType_ptr received_type;
eprosima::fastrtps::types::DynamicType_ptr received_type_;

std::atomic<bool> reception_flag{false};
std::atomic<bool> reception_flag_{false};

HelloWorldSubscriber* subscriber_;

Expand Down

0 comments on commit f100853

Please sign in to comment.