diff --git a/src/channel/mod.rs b/src/channel/mod.rs index 11f42a5..e01d430 100644 --- a/src/channel/mod.rs +++ b/src/channel/mod.rs @@ -73,7 +73,7 @@ macro_rules! clear_sender_wakers_common { if $seq & 15 != 0 { return; } - let limit = $self.tx_count.load(Ordering::Relaxed) as u64 + 200; + let limit = $self.tx_count.load(Ordering::Acquire) as u64 + 200; if $self.send_waker_rx_seq.load(Ordering::Acquire) + limit >= $seq { return; } @@ -104,7 +104,7 @@ macro_rules! clear_recv_wakers_common { if $seq & 15 != 0 { return; } - let limit = $self.rx_count.load(Ordering::Relaxed) as u64 + 500; + let limit = $self.rx_count.load(Ordering::Acquire) as u64 + 500; if $self.recv_waker_rx_seq.load(Ordering::Acquire) + limit >= $seq { return; } diff --git a/src/mpmc/bounded.rs b/src/mpmc/bounded.rs index e2d15e1..31b39d8 100644 --- a/src/mpmc/bounded.rs +++ b/src/mpmc/bounded.rs @@ -735,7 +735,7 @@ mod tests { None => break, } } - assert_eq!(counter.as_ref().load(Ordering::Relaxed), round * (tx_count as i32)); + assert_eq!(counter.as_ref().load(Ordering::Acquire), round * (tx_count as i32)); }); } @@ -800,7 +800,7 @@ mod tests { None => break, } } - assert_eq!(counter.as_ref().load(Ordering::Relaxed), round as i32); + assert_eq!(counter.as_ref().load(Ordering::Acquire), round as i32); }); for th in tx_ths { let _ = th.join(); @@ -878,7 +878,7 @@ mod tests { for th in rx_ths { let _ = th.join(); } - assert_eq!(counter.as_ref().load(Ordering::Relaxed), round * (tx_count as i32)); + assert_eq!(counter.as_ref().load(Ordering::Acquire), round * (tx_count as i32)); } #[test] diff --git a/src/mpsc/bounded.rs b/src/mpsc/bounded.rs index 1bb0656..1afb095 100644 --- a/src/mpsc/bounded.rs +++ b/src/mpsc/bounded.rs @@ -749,7 +749,7 @@ mod tests { None => break, } } - assert_eq!(counter.as_ref().load(Ordering::Relaxed), round * (tx_count as i32)); + assert_eq!(counter.as_ref().load(Ordering::Acquire), round * (tx_count as i32)); }); } @@ -787,7 +787,7 @@ mod tests { Err(_) => break 'A, } } - assert_eq!(counter.as_ref().load(Ordering::Relaxed), round * (tx_count as i32)); + assert_eq!(counter.as_ref().load(Ordering::Acquire), round * (tx_count as i32)); }); for th in tx_ths { let _ = th.join(); @@ -860,7 +860,7 @@ mod tests { for th in rx_ths { let _ = th.join(); } - assert_eq!(counter.as_ref().load(Ordering::Relaxed), round * (tx_count as i32)); + assert_eq!(counter.as_ref().load(Ordering::Acquire), round * (tx_count as i32)); } #[test]