Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Ensure compliant node construction/destruction API. #439

Merged
merged 6 commits into from
Jul 15, 2020

Conversation

hidmic
Copy link
Contributor

@hidmic hidmic commented Jul 7, 2020

Connected to ros2/rmw#249.

rmw_connext_shared_cpp/src/node.cpp Outdated Show resolved Hide resolved
rmw_connext_shared_cpp/src/node.cpp Outdated Show resolved Hide resolved
@hidmic
Copy link
Contributor Author

hidmic commented Jul 13, 2020

@clalancette @ivanpauno PTAL 99d15fb. I had to change the implementation to carry through with the node finalization despite runtime errors. It seemed like it was attempting one of those schemes of successive partial destructions.

Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
@hidmic hidmic force-pushed the hidmic/ensure-compliant-node-construction-destruction branch from 4df46fe to 555e7ab Compare July 13, 2020 22:19
@hidmic
Copy link
Contributor Author

hidmic commented Jul 14, 2020

Running CI up to test_rmw_implementation and all RMW implementations:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@@ -34,13 +37,42 @@ create_node(
const char * name,
const char * namespace_)
{
RCUTILS_CHECK_ARGUMENT_FOR_NULL(context, NULL);
assert(implementation_identifier != NULL);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one seems like one where we should RMW_CHECK_ARGUMENT_FOR_NULL. At the very least, that will make it operate the same as the checks for other NULL below, like context.

Also, here and elsewhere, we can use nullptr instead of NULL.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one seems like one where we should RMW_CHECK_ARGUMENT_FOR_NULL. At the very least, that will make it operate the same as the checks for other NULL below, like context.

We could, but given that this is a somewhat internal API (not a standalone RMW implementation) I'd rather not. But I give you that an assert here is unwarranted and almost redundant with the check below. Removed it.

RMW_SET_ERROR_MSG("node handle is null");
return RMW_RET_ERROR;
}
assert(implementation_identifier != NULL);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment about checking and returning on NULL, and using nullptr instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about it, but this rmw_connext* packages are already inconsistent in this regard pretty much everywhere. If you agree, I'd prefer doing that in a separate PR.

Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
@hidmic hidmic requested a review from clalancette July 14, 2020 19:19
@hidmic hidmic merged commit da982d1 into master Jul 15, 2020
@delete-merged-branch delete-merged-branch bot deleted the hidmic/ensure-compliant-node-construction-destruction branch July 15, 2020 13:23
ahcorde pushed a commit that referenced this pull request Oct 8, 2020
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
ahcorde pushed a commit that referenced this pull request Oct 15, 2020
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants