-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes IgnMonitor bug. #759
Fixes IgnMonitor bug. #759
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PTAL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PTAL
// Ignition subscriber callback, updating state | ||
// and notify all threads waiting on this instance. | ||
// | ||
// @param message Message received. | ||
void OnTopicMessage(const IGN_TYPE& message) { | ||
// A std::shared_ptr to `this` is created in order to guarantee | ||
// that the IgnMonitor instance isn't destroyed for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't --> hasn't been already
for --> at
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!!
// @param A pointer to this instance. | ||
// @throws std::logic_error When `self_ptr.get()` != `this`. | ||
void Initialize(std::shared_ptr<IgnMonitor<IGN_TYPE>> self_ptr) { | ||
DELPHYNE_VALIDATE(self_ptr.get() == this, std::logic_error, "self_ptr must point at `this` instance."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: must point at --> must point to
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
f2aab02
to
470523c
Compare
Sorry @agalbachicar, I had to push again. No changes since the last review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Related to #751
IgnMonitor
class subscribes a callback method to a topic.Ignition-transport7
doesn't guarantee that the callback method is executed while the instance of the class is still alive.The callback method being called after the instance was destroyed used to happen randomly in CI when stressed.
To solve that lack of synchronization we introduce a
std::share_ptr
of the IgnMonitor class into the callback method.See #751 for further information.