put relaxed back

This commit is contained in:
Bryan Stitt 2023-05-13 09:56:31 -07:00
parent 376c2261ea
commit b493f02c3d
2 changed files with 5 additions and 5 deletions

@ -97,7 +97,7 @@ impl AtomicRttEstimate {
/// This method omits the ordering argument since loads may use
/// slightly stale data to avoid adding additional latency.
pub fn load(&self) -> RttEstimate {
RttEstimate::from_pair(self.pair.load(Ordering::Acquire), self.start_time)
RttEstimate::from_pair(self.pair.load(Ordering::Relaxed), self.start_time)
}
/// Fetches the value, and applies a function to it that returns an
@ -114,7 +114,7 @@ impl AtomicRttEstimate {
let mut update_at = Instant::now();
let mut rtt = Duration::ZERO;
self.pair
.fetch_update(Ordering::Release, Ordering::Acquire, |pair| {
.fetch_update(Ordering::Relaxed, Ordering::Relaxed, |pair| {
rtt = f(RttEstimate::from_pair(pair, self.start_time));
// Save the new update_at inside the function in case it
// is run multiple times

@ -69,7 +69,7 @@ mod tests {
fn test_atomic_f32_pair_load() {
let pair = [f32::consts::PI, f32::consts::E];
let atomic = AtomicF32Pair::new(pair);
assert_eq!(pair, atomic.load(Ordering::Acquire));
assert_eq!(pair, atomic.load(Ordering::Relaxed));
}
#[test]
@ -77,13 +77,13 @@ mod tests {
let pair = [f32::consts::PI, f32::consts::E];
let atomic = AtomicF32Pair::new(pair);
atomic
.fetch_update(Ordering::Release, Ordering::Acquire, |[f1, f2]| {
.fetch_update(Ordering::Relaxed, Ordering::Relaxed, |[f1, f2]| {
Some([f1 + 1.0, f2 + 1.0])
})
.unwrap();
assert_eq!(
[pair[0] + 1.0, pair[1] + 1.0],
atomic.load(Ordering::Acquire)
atomic.load(Ordering::Relaxed)
);
}
}