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

[#264] Expose file descriptor in C++ bindings #526

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

elBoberido
Copy link
Member

Notes for Reviewer

This PR adds an API to expose the file descriptor of the listener in the C++ bindings. This is required if the listener needs to be used with a third party event loop.

The access does not happen directly but by a wrapper type to signal the unsafety of the operation.

Pre-Review Checklist for the PR Author

  1. Add sensible notes for the reviewer
  2. PR title is short, expressive and meaningful
  3. Relevant issues are linked in the References section
  4. Every source code file has a copyright header with SPDX-License-Identifier: Apache-2.0 OR MIT
  5. Branch follows the naming format (iox2-123-introduce-posix-ipc-example)
  6. Commits messages are according to this guideline
  7. Tests follow the best practice for testing
  8. Changelog updated in the unreleased section including API breaking changes
  9. Assign PR to reviewer
  10. All checks have passed (except task-list-completed)

Checklist for the PR Reviewer

  • Commits are properly organized and messages are according to the guideline
  • Unit tests have been written for new behavior
  • Public API is documented
  • PR title describes the changes

Post-review Checklist for the PR Author

  1. All open points are addressed and tracked via issues

References

Relates to #264

@elBoberido elBoberido self-assigned this Nov 25, 2024
@@ -80,6 +81,31 @@ class Listener {
/// in detail.
auto blocking_wait_one() -> iox::expected<iox::optional<EventId>, ListenerWaitError>;

private:
class Unsafe {
Copy link
Member Author

Choose a reason for hiding this comment

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

@elfenpiff @orecham I'm open to suggestions. I tried to be close to Rust and the call to access the file descriptor would look like auto fd = listener.unsafe().file_descriptor().expect("It works");

@elBoberido elBoberido force-pushed the iox2-264-expose-file-descriptor-in-cpp-api branch from 97601fa to 2e31e7a Compare November 25, 2024 15:09
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.

1 participant