Skip to content

Commit

Permalink
Feedback from review.
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Lalancette <[email protected]>
  • Loading branch information
clalancette committed Oct 16, 2024
1 parent 5462937 commit efd8918
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ SubscriptionData::SubscriptionData(
last_known_published_msg_({}),
total_messages_lost_(0),
wait_set_data_(nullptr),
is_shutdown_(false)
is_shutdown_(false),
initialized_(false)
{
events_mgr_ = std::make_shared<EventsManager>();
}
Expand Down Expand Up @@ -365,7 +366,7 @@ bool SubscriptionData::init()
undeclare_z_sub.cancel();
free_token.cancel();

initted_ = true;
initialized_ = true;

return true;
}
Expand Down Expand Up @@ -416,7 +417,7 @@ rmw_ret_t SubscriptionData::shutdown()
{
rmw_ret_t ret = RMW_RET_OK;
std::lock_guard<std::mutex> lock(mutex_);
if (is_shutdown_ || !initted_) {
if (is_shutdown_ || !initialized_) {
return ret;
}

Expand Down Expand Up @@ -451,7 +452,7 @@ rmw_ret_t SubscriptionData::shutdown()
}

is_shutdown_ = true;
initted_ = false;
initialized_ = false;
return ret;
}

Expand Down
4 changes: 2 additions & 2 deletions rmw_zenoh_cpp/src/detail/rmw_subscription_data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,6 @@ class SubscriptionData final : public std::enable_shared_from_this<SubscriptionD

bool init();

bool initted_{false};

// Internal mutex.
mutable std::mutex mutex_;
// The parent node.
Expand All @@ -162,6 +160,8 @@ class SubscriptionData final : public std::enable_shared_from_this<SubscriptionD
std::shared_ptr<EventsManager> events_mgr_;
// Shutdown flag.
bool is_shutdown_;
// Whether the object has ever successfully been initialized.
bool initialized_;
};
using SubscriptionDataPtr = std::shared_ptr<SubscriptionData>;
using SubscriptionDataConstPtr = std::shared_ptr<const SubscriptionData>;
Expand Down

0 comments on commit efd8918

Please sign in to comment.