diff --git a/doc/release-notes/iceoryx2-unreleased.md b/doc/release-notes/iceoryx2-unreleased.md index 0a26999417..03fee23d09 100644 --- a/doc/release-notes/iceoryx2-unreleased.md +++ b/doc/release-notes/iceoryx2-unreleased.md @@ -55,6 +55,8 @@ [#1321](https://github.com/eclipse-iceoryx/iceoryx2/issues/1321) * Remove `posix` feature and use `cfg` switch based on target instead [#1327](https://github.com/eclipse-iceoryx/iceoryx2/issues/1327) +* `CleanupState` implements `ZeroCopySend` + [#1331](https://github.com/eclipse-iceoryx/iceoryx2/issues/1331) ### Workflow diff --git a/iceoryx2-bb/lock-free/src/spsc/index_queue.rs b/iceoryx2-bb/lock-free/src/spsc/index_queue.rs index 2675d64c47..d47aa9e721 100644 --- a/iceoryx2-bb/lock-free/src/spsc/index_queue.rs +++ b/iceoryx2-bb/lock-free/src/spsc/index_queue.rs @@ -111,13 +111,13 @@ pub mod details { #[repr(C)] #[derive(Debug)] pub struct IndexQueue>> { - data_ptr: PointerType, - capacity: usize, write_position: AtomicU64, read_position: AtomicU64, pub(super) has_producer: AtomicBool, pub(super) has_consumer: AtomicBool, is_memory_initialized: AtomicBool, + capacity: usize, + data_ptr: PointerType, } unsafe impl>> Sync for IndexQueue {} diff --git a/iceoryx2-bb/lock-free/src/spsc/safely_overflowing_index_queue.rs b/iceoryx2-bb/lock-free/src/spsc/safely_overflowing_index_queue.rs index 7112425e5d..39825366fa 100644 --- a/iceoryx2-bb/lock-free/src/spsc/safely_overflowing_index_queue.rs +++ b/iceoryx2-bb/lock-free/src/spsc/safely_overflowing_index_queue.rs @@ -119,12 +119,12 @@ pub mod details { #[repr(C)] pub struct SafelyOverflowingIndexQueue>> { data_ptr: PointerType, - capacity: usize, - write_position: AtomicU64, - read_position: AtomicU64, pub(super) has_producer: AtomicBool, pub(super) has_consumer: AtomicBool, is_memory_initialized: AtomicBool, + capacity: usize, + write_position: AtomicU64, + read_position: AtomicU64, } unsafe impl>> Sync diff --git a/iceoryx2-cal/src/zero_copy_connection/common.rs b/iceoryx2-cal/src/zero_copy_connection/common.rs index 6d2a686fea..9cbdd018ba 100644 --- a/iceoryx2-cal/src/zero_copy_connection/common.rs +++ b/iceoryx2-cal/src/zero_copy_connection/common.rs @@ -160,9 +160,9 @@ pub mod details { #[derive(Debug)] #[repr(C)] struct Channel { - submission_queue: RelocatableSafelyOverflowingIndexQueue, - completion_queue: RelocatableIndexQueue, state: AtomicU64, + completion_queue: RelocatableIndexQueue, + submission_queue: RelocatableSafelyOverflowingIndexQueue, } impl Channel { diff --git a/iceoryx2-ffi/python/src/cleanup_state.rs b/iceoryx2-ffi/python/src/cleanup_state.rs index c14fdd99be..de3b3c0991 100644 --- a/iceoryx2-ffi/python/src/cleanup_state.rs +++ b/iceoryx2-ffi/python/src/cleanup_state.rs @@ -24,13 +24,13 @@ pub struct CleanupState(pub(crate) iceoryx2::node::CleanupState); impl CleanupState { #[getter] /// The number of successful dead node cleanups - pub fn cleanups(&self) -> usize { + pub fn cleanups(&self) -> u64 { self.0.cleanups } #[getter] /// The number of failed dead node cleanups - pub fn failed_cleanups(&self) -> usize { + pub fn failed_cleanups(&self) -> u64 { self.0.failed_cleanups } } diff --git a/iceoryx2/conformance-tests/src/node_death.rs b/iceoryx2/conformance-tests/src/node_death.rs index ae28e42d50..7022008668 100644 --- a/iceoryx2/conformance-tests/src/node_death.rs +++ b/iceoryx2/conformance-tests/src/node_death.rs @@ -187,7 +187,7 @@ pub mod node_death { core::mem::forget(bad_publishers); core::mem::forget(bad_subscribers); - assert_that!(Node::::cleanup_dead_nodes(&config), eq CleanupState { cleanups: NUMBER_OF_BAD_NODES, failed_cleanups: 0}); + assert_that!(Node::::cleanup_dead_nodes(&config), eq CleanupState { cleanups: NUMBER_OF_BAD_NODES as _, failed_cleanups: 0}); for service in &services { assert_that!(service.dynamic_config().number_of_publishers(), eq NUMBER_OF_PUBLISHERS - NUMBER_OF_BAD_NODES); @@ -269,7 +269,7 @@ pub mod node_death { core::mem::forget(bad_notifiers); core::mem::forget(bad_listeners); - assert_that!(Node::::cleanup_dead_nodes(&config), eq CleanupState { cleanups: NUMBER_OF_BAD_NODES, failed_cleanups: 0}); + assert_that!(Node::::cleanup_dead_nodes(&config), eq CleanupState { cleanups: NUMBER_OF_BAD_NODES as _, failed_cleanups: 0}); for service in &services { assert_that!(service.dynamic_config().number_of_notifiers(), eq NUMBER_OF_NOTIFIERS - NUMBER_OF_BAD_NODES); @@ -394,7 +394,7 @@ pub mod node_death { core::mem::forget(bad_clients); core::mem::forget(bad_servers); - assert_that!(Node::::cleanup_dead_nodes(&config), eq CleanupState { cleanups: NUMBER_OF_BAD_NODES, failed_cleanups: 0}); + assert_that!(Node::::cleanup_dead_nodes(&config), eq CleanupState { cleanups: NUMBER_OF_BAD_NODES as _, failed_cleanups: 0}); for service in &services { assert_that!(service.dynamic_config().number_of_clients(), eq NUMBER_OF_CLIENTS - NUMBER_OF_BAD_NODES); @@ -475,7 +475,7 @@ pub mod node_death { core::mem::forget(bad_readers); - assert_that!(Node::::cleanup_dead_nodes(&config), eq CleanupState { cleanups: NUMBER_OF_BAD_NODES, failed_cleanups: 0}); + assert_that!(Node::::cleanup_dead_nodes(&config), eq CleanupState { cleanups: NUMBER_OF_BAD_NODES as _, failed_cleanups: 0}); for service in &services { assert_that!(service.dynamic_config().number_of_readers(), eq NUMBER_OF_READERS - NUMBER_OF_BAD_NODES); diff --git a/iceoryx2/src/node/mod.rs b/iceoryx2/src/node/mod.rs index 9c34e690f9..8d3c67e668 100644 --- a/iceoryx2/src/node/mod.rs +++ b/iceoryx2/src/node/mod.rs @@ -439,12 +439,13 @@ impl NodeState { /// could not be cleaned up. /// This does not have to be an error, for instance when the current process does not /// have the permission to access the corresponding resources. -#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, ZeroCopySend)] +#[repr(C)] pub struct CleanupState { /// The number of successful dead node cleanups - pub cleanups: usize, + pub cleanups: u64, /// The number of failed dead node cleanups - pub failed_cleanups: usize, + pub failed_cleanups: u64, } /// Contains all available details of a [`Node`].