You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Ordering::AcqRel implementation contradicts the docs #49127
AcqRel
When coupled with a load, uses `Acquire` ordering, and with a store `Release` ordering.
However, this code
use std::sync::atomic::{AtomicBool, Ordering};
fn main() {
let b = AtomicBool::new(false);
b.store(true, Ordering::AcqRel);
b.load(Ordering::AcqRel);
}
panics on both store and load (if the call to store() is commented out)
thread 'main' panicked at 'there is no such thing as an acquire/release store', /checkout/src/libcore/sync/atomic.rs:1482:19
note: Run with `RUST_BACKTRACE=1` for a backtrace.
Either documentation should be updated to describe why this is not relevant to store/load, or implementation should be fixed to actually deliver on the promise.
The implementation is correct. AcquireRelease is an ordering for operations that both load and store. If you just have a load or a store, you can and should simply use acquire or release respectively.
Activity
hanna-kruppe commentedon Mar 18, 2018
The implementation is correct. AcquireRelease is an ordering for operations that both load and store. If you just have a load or a store, you can and should simply use acquire or release respectively.
imp commentedon Mar 18, 2018
Ok, makes sense. Then the documentation should reflect that more clearly.
Rollup merge of rust-lang#49170 - steveklabnik:gh49127, r=nagisa
Rollup merge of rust-lang#49170 - steveklabnik:gh49127, r=nagisa