mirror of
https://github.com/rust-embedded/heapless.git
synced 2025-09-30 14:00:29 +00:00
fix the contention test
patch by @pftbest ❤️
This commit is contained in:
parent
40994962e2
commit
ffcd423e67
@ -29,6 +29,10 @@ impl AtomicUsize {
|
||||
unsafe { &mut *self.v.get() }
|
||||
}
|
||||
|
||||
pub fn load_acquire(&self) -> usize {
|
||||
unsafe { intrinsics::atomic_load_acq(self.v.get()) }
|
||||
}
|
||||
|
||||
pub fn load_relaxed(&self) -> usize {
|
||||
unsafe { intrinsics::atomic_load_relaxed(self.v.get()) }
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ where
|
||||
let n = rb.capacity() + 1;
|
||||
let buffer: &[T] = unsafe { rb.buffer.as_ref() };
|
||||
|
||||
let tail = rb.tail.load_relaxed();
|
||||
let tail = rb.tail.load_acquire();
|
||||
let head = rb.head.load_relaxed();
|
||||
if head != tail {
|
||||
let item = unsafe { ptr::read(buffer.get_unchecked(head)) };
|
||||
|
Loading…
x
Reference in New Issue
Block a user