Open
Description
This crate has the same issue as mystor/atomic_ref#5.
The following code segfaults on an AArch64 machine (but not on x86_64, which has a stronger memory model).
#![deny(unsafe_code)]
use atom::Atom;
use std::sync::atomic::Ordering;
fn main() {
let channel = &*Box::leak(Box::new(Atom::<&&'static u32>::new(&&42u32)));
std::thread::spawn(move || loop {
if let Some(ptr) = channel.take(Ordering::Relaxed) {
assert_eq!(**ptr, 42);
}
});
for i in 0..10000000 {
let b = Box::leak(Box::new(&42u32));
channel.swap(b, Ordering::Relaxed);
}
}
Metadata
Assignees
Labels
No labels