Skip to content
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

Introduce ddsrt_abort and ddsrt_exit #1877

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

poetinger
Copy link
Contributor

This pull request:

  • Introduces ddsrt_abort and ddsrt_exit
  • Replaces abort with ddsrt_abort in ddsc, ddsrt, cdr, and ddsi
  • Addes a symbol export test for each

This will consolidate abort calls. This will make it easy to override, change, or suppress the abort feature. Borrowing a bit of structure from Rust, the new `ddsrt_abort` was placed inside ddsrt::process.
Copy link
Contributor

@eboasson eboasson left a comment

Choose a reason for hiding this comment

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

Thanks @poetinger, I do see the practical value of not calling abort() directly but putting something in between if one is using an embedded platform — at least I have found something of the sort useful in the past 🙂.

So that's the good bit.

The bad bit is that not all the aborts in the core code have been replaced, for example src/core/cdr/src/dds_cdrstream_keys.part.c have a bunch left.

Not replacing abort in all locations (like tests) is a defensible choice, but I think it only makes life more complicated to sometimes use abort and sometimes use ddsrt_abort: now one has to decide which one to use. So I think all should be replaced and only a single call to abort should remain, in ddsrt_abort.

The subject of exit is another story. Cyclone DDS comes in multiple parts: the core bit is a library—this should never terminate and so should never call exit to begin with, and it doesn't—and then there are some tools/examples/tests that use it. I don't quite see why something like ddsperf can't just call exit.

So unless you have a good argument why exit must be avoided at all cost, I'd take out the 11 changes related to it.

@poetinger
Copy link
Contributor Author

Sounds reasonable to me. I'll remove ddsrt_exit and do another pass for missing aborts, including the ones in tests 👍.

Signed-off-by: Philip Oetinger <philip.oetinger@zettascale.tech>
From feedback comment, it really is unnecessary.

Signed-off-by: Philip Oetinger <philip.oetinger@zettascale.tech>
@poetinger poetinger requested a review from eboasson April 22, 2024 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants