Skip to main content

atomic_store_u64_release

Function atomic_store_u64_release 

Source
pub unsafe fn atomic_store_u64_release(addr: *mut u64, value: u64)
Expand description

This performs an atomic store-release of a 64-bit value to addr. Use this if you have a u64 or your struct is align(8).

Rust’s memory model defines how atomics work across threads, but doesn’t account for the way Starnix handles access across mutually distrusting address spaces. This Seqlock is intended to be mapped and read by different address spaces. Rust’s guarantees do not apply and reading across these address spaces is undefined behavior. Theoretically the Rust compiler could determine that the atomic is never read from within the process and optimize out the store. We work around this by directly including the assembly an atomic would generate to prevent the compiler from “helpfully” optimizing it away.

§Safety

  1. The caller must ensure addr points to an address ptr that is valid and 8-byte aligned. The addr must be writable by the current process.
  2. The caller must ensure that no other non-atomic operations are occurring on this memory address simultaneously.