Skip to content

Commit a92bea3

Browse files
authored
Merge pull request #1332 from ekxide/iox2-1331-make-cleanupstate-zerocopysend
[#1331] make cleanupstate zerocopysend
2 parents f6787bf + dd6d304 commit a92bea3

File tree

7 files changed

+19
-16
lines changed

7 files changed

+19
-16
lines changed

doc/release-notes/iceoryx2-unreleased.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@
5555
[#1321](https://github.com/eclipse-iceoryx/iceoryx2/issues/1321)
5656
* Remove `posix` feature and use `cfg` switch based on target instead
5757
[#1327](https://github.com/eclipse-iceoryx/iceoryx2/issues/1327)
58+
* `CleanupState` implements `ZeroCopySend`
59+
[#1331](https://github.com/eclipse-iceoryx/iceoryx2/issues/1331)
5860

5961
### Workflow
6062

iceoryx2-bb/lock-free/src/spsc/index_queue.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,13 @@ pub mod details {
111111
#[repr(C)]
112112
#[derive(Debug)]
113113
pub struct IndexQueue<PointerType: PointerTrait<UnsafeCell<u64>>> {
114-
data_ptr: PointerType,
115-
capacity: usize,
116114
write_position: AtomicU64,
117115
read_position: AtomicU64,
118116
pub(super) has_producer: AtomicBool,
119117
pub(super) has_consumer: AtomicBool,
120118
is_memory_initialized: AtomicBool,
119+
capacity: usize,
120+
data_ptr: PointerType,
121121
}
122122

123123
unsafe impl<PointerType: PointerTrait<UnsafeCell<u64>>> Sync for IndexQueue<PointerType> {}

iceoryx2-bb/lock-free/src/spsc/safely_overflowing_index_queue.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,12 @@ pub mod details {
119119
#[repr(C)]
120120
pub struct SafelyOverflowingIndexQueue<PointerType: PointerTrait<UnsafeCell<u64>>> {
121121
data_ptr: PointerType,
122-
capacity: usize,
123-
write_position: AtomicU64,
124-
read_position: AtomicU64,
125122
pub(super) has_producer: AtomicBool,
126123
pub(super) has_consumer: AtomicBool,
127124
is_memory_initialized: AtomicBool,
125+
capacity: usize,
126+
write_position: AtomicU64,
127+
read_position: AtomicU64,
128128
}
129129

130130
unsafe impl<PointerType: PointerTrait<UnsafeCell<u64>>> Sync

iceoryx2-cal/src/zero_copy_connection/common.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,9 @@ pub mod details {
160160
#[derive(Debug)]
161161
#[repr(C)]
162162
struct Channel {
163-
submission_queue: RelocatableSafelyOverflowingIndexQueue,
164-
completion_queue: RelocatableIndexQueue,
165163
state: AtomicU64,
164+
completion_queue: RelocatableIndexQueue,
165+
submission_queue: RelocatableSafelyOverflowingIndexQueue,
166166
}
167167

168168
impl Channel {

iceoryx2-ffi/python/src/cleanup_state.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ pub struct CleanupState(pub(crate) iceoryx2::node::CleanupState);
2424
impl CleanupState {
2525
#[getter]
2626
/// The number of successful dead node cleanups
27-
pub fn cleanups(&self) -> usize {
27+
pub fn cleanups(&self) -> u64 {
2828
self.0.cleanups
2929
}
3030

3131
#[getter]
3232
/// The number of failed dead node cleanups
33-
pub fn failed_cleanups(&self) -> usize {
33+
pub fn failed_cleanups(&self) -> u64 {
3434
self.0.failed_cleanups
3535
}
3636
}

iceoryx2/conformance-tests/src/node_death.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ pub mod node_death {
187187
core::mem::forget(bad_publishers);
188188
core::mem::forget(bad_subscribers);
189189

190-
assert_that!(Node::<S::Service>::cleanup_dead_nodes(&config), eq CleanupState { cleanups: NUMBER_OF_BAD_NODES, failed_cleanups: 0});
190+
assert_that!(Node::<S::Service>::cleanup_dead_nodes(&config), eq CleanupState { cleanups: NUMBER_OF_BAD_NODES as _, failed_cleanups: 0});
191191

192192
for service in &services {
193193
assert_that!(service.dynamic_config().number_of_publishers(), eq NUMBER_OF_PUBLISHERS - NUMBER_OF_BAD_NODES);
@@ -269,7 +269,7 @@ pub mod node_death {
269269
core::mem::forget(bad_notifiers);
270270
core::mem::forget(bad_listeners);
271271

272-
assert_that!(Node::<S::Service>::cleanup_dead_nodes(&config), eq CleanupState { cleanups: NUMBER_OF_BAD_NODES, failed_cleanups: 0});
272+
assert_that!(Node::<S::Service>::cleanup_dead_nodes(&config), eq CleanupState { cleanups: NUMBER_OF_BAD_NODES as _, failed_cleanups: 0});
273273

274274
for service in &services {
275275
assert_that!(service.dynamic_config().number_of_notifiers(), eq NUMBER_OF_NOTIFIERS - NUMBER_OF_BAD_NODES);
@@ -394,7 +394,7 @@ pub mod node_death {
394394
core::mem::forget(bad_clients);
395395
core::mem::forget(bad_servers);
396396

397-
assert_that!(Node::<S::Service>::cleanup_dead_nodes(&config), eq CleanupState { cleanups: NUMBER_OF_BAD_NODES, failed_cleanups: 0});
397+
assert_that!(Node::<S::Service>::cleanup_dead_nodes(&config), eq CleanupState { cleanups: NUMBER_OF_BAD_NODES as _, failed_cleanups: 0});
398398

399399
for service in &services {
400400
assert_that!(service.dynamic_config().number_of_clients(), eq NUMBER_OF_CLIENTS - NUMBER_OF_BAD_NODES);
@@ -475,7 +475,7 @@ pub mod node_death {
475475

476476
core::mem::forget(bad_readers);
477477

478-
assert_that!(Node::<S::Service>::cleanup_dead_nodes(&config), eq CleanupState { cleanups: NUMBER_OF_BAD_NODES, failed_cleanups: 0});
478+
assert_that!(Node::<S::Service>::cleanup_dead_nodes(&config), eq CleanupState { cleanups: NUMBER_OF_BAD_NODES as _, failed_cleanups: 0});
479479

480480
for service in &services {
481481
assert_that!(service.dynamic_config().number_of_readers(), eq NUMBER_OF_READERS - NUMBER_OF_BAD_NODES);

iceoryx2/src/node/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -439,12 +439,13 @@ impl<Service: service::Service> NodeState<Service> {
439439
/// could not be cleaned up.
440440
/// This does not have to be an error, for instance when the current process does not
441441
/// have the permission to access the corresponding resources.
442-
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
442+
#[derive(Debug, Clone, Copy, PartialEq, Eq, ZeroCopySend)]
443+
#[repr(C)]
443444
pub struct CleanupState {
444445
/// The number of successful dead node cleanups
445-
pub cleanups: usize,
446+
pub cleanups: u64,
446447
/// The number of failed dead node cleanups
447-
pub failed_cleanups: usize,
448+
pub failed_cleanups: u64,
448449
}
449450

450451
/// Contains all available details of a [`Node`].

0 commit comments

Comments
 (0)