Skip to content

Commit

Permalink
Merge pull request #548 from elfenpiff/iox2-547-move-waitset
Browse files Browse the repository at this point in the history
[#547] Move waitset into main iox2 namespace
  • Loading branch information
elfenpiff authored Dec 16, 2024
2 parents 201ed64 + dbc22d6 commit a628ba5
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 20 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -479,10 +479,17 @@ jobs:
internal/scripts/ci_prepare_ubuntu.sh
uname -a
- name: Set up Bazel
uses: bazel-contrib/[email protected]

- name: Run bazel build
env:
USE_BAZEL_VERSION: "7.4.1"
run: bazel build //...

- name: Run bazel test
env:
USE_BAZEL_VERSION: "7.4.1"
run: bazel test //...

grcov:
Expand Down
4 changes: 2 additions & 2 deletions iceoryx2-ffi/ffi/src/api/waitset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ use crate::{

use super::{iox2_signal_handling_mode_e, AssertNonNullHandle, HandleToType, IntoCInt};
use iceoryx2::{
port::waitset::{
service::{ipc, local},
waitset::{
WaitSet, WaitSetAttachmentError, WaitSetCreateError, WaitSetRunError, WaitSetRunResult,
},
service::{ipc, local},
};
use iceoryx2_bb_derive_macros::StringLiteral;
use iceoryx2_bb_elementary::static_assert::*;
Expand Down
2 changes: 1 addition & 1 deletion iceoryx2-ffi/ffi/src/api/waitset_guard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
use std::mem::ManuallyDrop;

use crate::iox2_service_type_e;
use iceoryx2::port::waitset::WaitSetGuard;
use iceoryx2::service::{ipc, local};
use iceoryx2::waitset::WaitSetGuard;
use iceoryx2_bb_elementary::static_assert::*;
use iceoryx2_ffi_macros::iceoryx2_ffi;

Expand Down
6 changes: 5 additions & 1 deletion iceoryx2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,15 @@ pub mod sample_mut_uninit;
pub mod service;

/// Defines how constructs like the [`Node`](crate::node::Node) or the
/// [`WaitSet`](crate::port::waitset::WaitSet) shall handle system signals.
/// [`WaitSet`](crate::waitset::WaitSet) shall handle system signals.
pub mod signal_handling_mode;

/// Loads a meaninful subset to cover 90% of the iceoryx2 communication use cases.
pub mod prelude;

#[doc(hidden)]
pub mod testing;

/// Event handling mechanism to wait on multiple [`Listener`](crate::port::listener::Listener)s
/// in one call, realizing the reactor pattern. (Event multiplexer)
pub mod waitset;
3 changes: 0 additions & 3 deletions iceoryx2/src/port/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ pub mod subscriber;
/// Interface to perform cyclic updates to the ports. Required to deliver history to new
/// participants or to perform other management tasks.
pub mod update_connections;
/// Event handling mechanism to wait on multiple [`Listener`](crate::port::listener::Listener)s
/// in one call, realizing the reactor pattern. (Event multiplexer)
pub mod waitset;

use crate::port::port_identifiers::*;
use crate::service;
Expand Down
2 changes: 1 addition & 1 deletion iceoryx2/src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
pub use crate::config::Config;
pub use crate::node::{node_name::NodeName, Node, NodeBuilder, NodeState};
pub use crate::port::event_id::EventId;
pub use crate::port::waitset::{WaitSet, WaitSetAttachmentId, WaitSetBuilder, WaitSetGuard};
pub use crate::service::messaging_pattern::MessagingPattern;
pub use crate::service::{
attribute::AttributeSet, attribute::AttributeSpecifier, attribute::AttributeVerifier, ipc,
local, port_factory::publisher::UnableToDeliverStrategy, port_factory::PortFactory,
service_name::ServiceName, Service, ServiceDetails,
};
pub use crate::signal_handling_mode::SignalHandlingMode;
pub use crate::waitset::{WaitSet, WaitSetAttachmentId, WaitSetBuilder, WaitSetGuard};
pub use iceoryx2_bb_derive_macros::PlacementDefault;
pub use iceoryx2_bb_elementary::alignment::Alignment;
pub use iceoryx2_bb_elementary::placement_default::PlacementDefault;
Expand Down
22 changes: 11 additions & 11 deletions iceoryx2/src/port/waitset.rs → iceoryx2/src/waitset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,29 @@
//
// SPDX-License-Identifier: Apache-2.0 OR MIT

//! A [`WaitSet`](crate::port::waitset::WaitSet) is an implementation of an event multiplexer
//! A [`WaitSet`](crate::waitset::WaitSet) is an implementation of an event multiplexer
//! (Reactor of the reactor design pattern). It allows the user to attach notifications,
//! deadlines or intervals.
//!
//! * **Notification** - An object that emits an event. Whenever the event is detected the
//! [`WaitSet`](crate::port::waitset::WaitSet) wakes up and informs the user.
//! [`WaitSet`](crate::waitset::WaitSet) wakes up and informs the user.
//! Typical use case are gateways, which receives and forwards data whenever new data
//! is available.
//! * **Deadline** - Like a *Notification* with the exception that the *Deadline* expects an
//! event after a certain predefined timeout. If the event does not arrive before the
//! timeout has passed, the [`WaitSet`](crate::port::waitset::WaitSet) wakes up and informs
//! timeout has passed, the [`WaitSet`](crate::waitset::WaitSet) wakes up and informs
//! the user that th *Deadline* has missed its timeout.
//! Whenever a *Deadline* receives an event, the timeout is reset.
//! One example is a sensor that shall send an update every 100ms and the applications requires
//! the sensor data latest after 120ms. If after 120ms an update
//! is not available the application must wake up and take counter measures. If the update
//! arrives within the timeout, the timeout is reset back to 120ms.
//! * **Interval** - An time period after which the [`WaitSet`](crate::port::waitset::WaitSet)
//! * **Interval** - An time period after which the [`WaitSet`](crate::waitset::WaitSet)
//! wakes up and informs the user that the time has passed by.
//! This is useful when a [`Publisher`](crate::port::publisher::Publisher) shall send an
//! heartbeat every 100ms.
//!
//! The [`WaitSet`](crate::port::waitset::WaitSet) allows the user to attach multiple
//! The [`WaitSet`](crate::waitset::WaitSet) allows the user to attach multiple
//! [`Listener`](crate::port::listener::Listener) from multiple [`Node`](crate::node::Node)s,
//! anything that implements
//! [`SynchronousMultiplexing`](iceoryx2_bb_posix::file_descriptor_set::SynchronousMultiplexing)
Expand Down Expand Up @@ -185,14 +185,14 @@
//! # }
//! ```
//!
//! ## Using [`WaitSet`](crate::port::waitset::WaitSet) Without [`Signal`](iceoryx2_bb_posix::signal::Signal) Handling
//! ## Using [`WaitSet`](crate::waitset::WaitSet) Without [`Signal`](iceoryx2_bb_posix::signal::Signal) Handling
//!
//! This example demonstrates how the [`WaitSet`](crate::port::waitset::WaitSet) can be used when
//! This example demonstrates how the [`WaitSet`](crate::waitset::WaitSet) can be used when
//! system signals are being handled elsewhere. The builder parameter
//! [`WaitSetBuilder::signal_handling_mode()`](crate::port::waitset::WaitSetBuilder::signal_handling_mode())
//! can be used to disable signal handling in all [`WaitSet`](crate::port::waitset::WaitSet) calls
//! like [`WaitSet::wait_and_process()`](crate::port::waitset::WaitSet::wait_and_process()) or
//! [`WaitSet::wait_and_process_once()`](crate::port::waitset::WaitSet::wait_and_process_once()).
//! [`WaitSetBuilder::signal_handling_mode()`](crate::waitset::WaitSetBuilder::signal_handling_mode())
//! can be used to disable signal handling in all [`WaitSet`](crate::waitset::WaitSet) calls
//! like [`WaitSet::wait_and_process()`](crate::waitset::WaitSet::wait_and_process()) or
//! [`WaitSet::wait_and_process_once()`](crate::waitset::WaitSet::wait_and_process_once()).
//!
//! ```no_run
//! use iceoryx2::prelude::*;
Expand Down
2 changes: 1 addition & 1 deletion iceoryx2/tests/waitset_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ mod waitset {

use iceoryx2::port::listener::Listener;
use iceoryx2::port::notifier::Notifier;
use iceoryx2::port::waitset::{WaitSetAttachmentError, WaitSetRunError};
use iceoryx2::prelude::{WaitSetBuilder, *};
use iceoryx2::testing::*;
use iceoryx2::waitset::{WaitSetAttachmentError, WaitSetRunError};
use iceoryx2_bb_posix::config::test_directory;
use iceoryx2_bb_posix::directory::Directory;
use iceoryx2_bb_posix::file::Permission;
Expand Down

0 comments on commit a628ba5

Please sign in to comment.