Skip to content

Commit

Permalink
test: Fix atomic ordering for arm
Browse files Browse the repository at this point in the history
  • Loading branch information
frostyplanet committed Aug 29, 2023
1 parent 7d4e826 commit 2b287d5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/channel/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions src/mpmc/bounded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
});
}

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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]
Expand Down
6 changes: 3 additions & 3 deletions src/mpsc/bounded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
});
}

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit 2b287d5

Please sign in to comment.