From 9faea687d12c79f42217efdc7b31b49ff3830021 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio <jorge@japaric.io> Date: Wed, 8 Nov 2017 23:06:25 +0100 Subject: [PATCH] load_acquire -> load_relaxed --- src/ring_buffer/mod.rs | 4 ---- src/ring_buffer/spsc.rs | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/ring_buffer/mod.rs b/src/ring_buffer/mod.rs index 3747194..3f53646 100644 --- a/src/ring_buffer/mod.rs +++ b/src/ring_buffer/mod.rs @@ -29,10 +29,6 @@ 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()) } } diff --git a/src/ring_buffer/spsc.rs b/src/ring_buffer/spsc.rs index 0c38497..4c93f42 100644 --- a/src/ring_buffer/spsc.rs +++ b/src/ring_buffer/spsc.rs @@ -43,7 +43,7 @@ where let buffer: &[T] = unsafe { rb.buffer.as_ref() }; let tail = rb.tail.load_relaxed(); - let head = rb.head.load_acquire(); + let head = rb.head.load_relaxed(); if head != tail { let item = unsafe { ptr::read(buffer.get_unchecked(head)) }; rb.head.store_release((head + 1) % n); @@ -85,7 +85,7 @@ where let buffer: &mut [T] = unsafe { rb.buffer.as_mut() }; let head = rb.head.load_relaxed(); - let tail = rb.tail.load_acquire(); + let tail = rb.tail.load_relaxed(); let next_tail = (tail + 1) % n; if next_tail != head { // NOTE(ptr::write) the memory slot that we are about to write to is uninitialized. We -- GitLab