put relaxed back
This commit is contained in:
parent
376c2261ea
commit
b493f02c3d
@ -97,7 +97,7 @@ impl AtomicRttEstimate {
|
|||||||
/// This method omits the ordering argument since loads may use
|
/// This method omits the ordering argument since loads may use
|
||||||
/// slightly stale data to avoid adding additional latency.
|
/// slightly stale data to avoid adding additional latency.
|
||||||
pub fn load(&self) -> RttEstimate {
|
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
|
/// 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 update_at = Instant::now();
|
||||||
let mut rtt = Duration::ZERO;
|
let mut rtt = Duration::ZERO;
|
||||||
self.pair
|
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));
|
rtt = f(RttEstimate::from_pair(pair, self.start_time));
|
||||||
// Save the new update_at inside the function in case it
|
// Save the new update_at inside the function in case it
|
||||||
// is run multiple times
|
// is run multiple times
|
||||||
|
@ -69,7 +69,7 @@ mod tests {
|
|||||||
fn test_atomic_f32_pair_load() {
|
fn test_atomic_f32_pair_load() {
|
||||||
let pair = [f32::consts::PI, f32::consts::E];
|
let pair = [f32::consts::PI, f32::consts::E];
|
||||||
let atomic = AtomicF32Pair::new(pair);
|
let atomic = AtomicF32Pair::new(pair);
|
||||||
assert_eq!(pair, atomic.load(Ordering::Acquire));
|
assert_eq!(pair, atomic.load(Ordering::Relaxed));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -77,13 +77,13 @@ mod tests {
|
|||||||
let pair = [f32::consts::PI, f32::consts::E];
|
let pair = [f32::consts::PI, f32::consts::E];
|
||||||
let atomic = AtomicF32Pair::new(pair);
|
let atomic = AtomicF32Pair::new(pair);
|
||||||
atomic
|
atomic
|
||||||
.fetch_update(Ordering::Release, Ordering::Acquire, |[f1, f2]| {
|
.fetch_update(Ordering::Relaxed, Ordering::Relaxed, |[f1, f2]| {
|
||||||
Some([f1 + 1.0, f2 + 1.0])
|
Some([f1 + 1.0, f2 + 1.0])
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
[pair[0] + 1.0, pair[1] + 1.0],
|
[pair[0] + 1.0, pair[1] + 1.0],
|
||||||
atomic.load(Ordering::Acquire)
|
atomic.load(Ordering::Relaxed)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user