Skip to content

Commit

Permalink
[eclipse-iceoryx#349] Fix bug where a copy of the version number is c…
Browse files Browse the repository at this point in the history
…hecked for changes instead of reloading the underlying memory
  • Loading branch information
elfenpiff committed Oct 16, 2024
1 parent 3a8b0ee commit 80237bc
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions iceoryx2-cal/src/dynamic_storage/posix_shared_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,18 +215,18 @@ impl<'builder, T: Send + Sync + Debug> Builder<'builder, T> {

let init_state = shm.base_address().as_ptr() as *const Data<T>;

// The mem-sync is actually not required since an uninitialized dynamic storage has
// only write permissions and can be therefore not consumed.
// This is only for the case that this strategy fails on an obscure POSIX platform.
//
//////////////////////////////////////////
// SYNC POINT: read Data<T>::data
//////////////////////////////////////////
let package_version = unsafe { &(*init_state) }
.version
.load(std::sync::atomic::Ordering::SeqCst);

loop {
// The mem-sync is actually not required since an uninitialized dynamic storage has
// only write permissions and can be therefore not consumed.
// This is only for the case that this strategy fails on an obscure POSIX platform.
//
//////////////////////////////////////////
// SYNC POINT: read Data<T>::data
//////////////////////////////////////////
let package_version = unsafe { &(*init_state) }
.version
.load(std::sync::atomic::Ordering::SeqCst);

let package_version = PackageVersion::from_u64(package_version);
if package_version.to_u64() == 0 {
if elapsed_time >= self.timeout {
Expand Down

0 comments on commit 80237bc

Please sign in to comment.