Rollup merge of #96616 - akiekintveld:min_stack_relaxed_ordering, r=joshtriplett
Relax memory ordering used in `min_stack` `min_stack` does not provide any synchronization guarantees to its callers, and only requires atomicity for `MIN` itself, so relaxed memory ordering is sufficient.
This commit is contained in:
commit
8385d1713e
@ -4,7 +4,7 @@
|
||||
|
||||
pub fn min_stack() -> usize {
|
||||
static MIN: atomic::AtomicUsize = atomic::AtomicUsize::new(0);
|
||||
match MIN.load(Ordering::SeqCst) {
|
||||
match MIN.load(Ordering::Relaxed) {
|
||||
0 => {}
|
||||
n => return n - 1,
|
||||
}
|
||||
@ -13,6 +13,6 @@ pub fn min_stack() -> usize {
|
||||
|
||||
// 0 is our sentinel value, so ensure that we'll never see 0 after
|
||||
// initialization has run
|
||||
MIN.store(amt + 1, Ordering::SeqCst);
|
||||
MIN.store(amt + 1, Ordering::Relaxed);
|
||||
amt
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user