eclipse-iceoryx / iceoryx2

Eclipse iceoryx2™ - true zero-copy inter-process-communication in pure Rust
https://iceoryx.io
Apache License 2.0
1.02k stars 38 forks source link

iceoryx WaitSet integration #390

Closed elfenpiff closed 1 month ago

elfenpiff commented 1 month ago

Brief feature description

In iceoryx2 we require an event multiplexing mechanism like the iceoryx waitset. It is connected to Node::wait() and maybe integrated into the Node or a separate mechanism.

ToDo List

Terms

API

impl WaitSetBuilder {
  fn new() -> Self;
  fn allocator(); // sets custom allocator to now allocate management stuff on the heap
  fn tick(CyclicTimer); // sets tick timeout, whenever wait/run shall emit WaitEvent::Tick
  fn create();
}

pub enum Attachment<'a, T: SynchronousMultiplexing> {
  Notification(&'a T),
  Deadline((&'a T, Duration)),
  Tick(Duration),
};

impl WaitSet {
  fn attach<T>(attachment: Attachment);
  fn run(callback); // runs in a timed loop defined by tick
  fn try_run(callback); // no ticks? tries to gather all events.
}

Preconsiderations

Details

Results

  1. Node::wait() is obsolete?
  2. Create WaitsetBuilder and provide optionally allocator for custom dynamic memory, otherwise use heap
  3. Waitset::attach_fn() must, Waitset::attach()
  4. Aim for
    while event = waitset::wait() {
    event.call(); // call callback set with `attach_fn()`.
    }
    1. Is independent of the node!