@@ -193,32 +193,67 @@ pub enum Ordering {
193193 /// [`Monotonic`]: http://llvm.org/docs/Atomics.html#monotonic
194194 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
195195 Relaxed ,
196- /// When coupled with a store, all previous writes become visible
197- /// to the other threads that perform a load with [`Acquire`] ordering
198- /// on the same value.
196+ /// When coupled with a store, all previous operations become ordered
197+ /// before any load of this value with [`Acquire`] (or stronger) ordering.
198+ /// In particular, all previous writes become visible to all threads
199+ /// that perform an [`Acquire`] (or stronger) load of this value.
199200 ///
201+ /// Notice that using this ordering for an operation that combines loads
202+ /// and stores leads to a [`Relaxed`] load operation!
203+ ///
204+ /// This ordering is only applicable for operations that can perform a store.
205+ ///
206+ /// Corresponds to LLVM's [`Release`] ordering.
207+ ///
208+ /// [`Release`]: http://llvm.org/docs/Atomics.html#release
200209 /// [`Acquire`]: http://llvm.org/docs/Atomics.html#acquire
210+ /// [`Relaxed`]: https://llvm.org/docs/Atomics.html#monotonic
201211 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
202212 Release ,
203- /// When coupled with a load, all subsequent loads will see data
204- /// written before a store with [`Release`] ordering on the same value
205- /// in other threads.
213+ /// When coupled with a load, if the loaded value was written by a store operation with
214+ /// [`Release`] (or stronger) ordering, then all subsequent operations
215+ /// become ordered after that store. In particular, all subsequent loads will see data
216+ /// written before the store.
206217 ///
218+ /// Notice that using this ordering for an operation that combines loads
219+ /// and stores leads to a [`Relaxed`] store operation!
220+ ///
221+ /// This ordering is only applicable for operations that can perform a load.
222+ ///
223+ /// Corresponds to LLVM's [`Acquire`] ordering.
224+ ///
225+ /// [`Acquire`]: http://llvm.org/docs/Atomics.html#acquire
207226 /// [`Release`]: http://llvm.org/docs/Atomics.html#release
227+ /// [`Relaxed`]: https://llvm.org/docs/Atomics.html#monotonic
208228 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
209229 Acquire ,
210- /// Has the effects of both [`Acquire`] and [`Release`] together.
230+ /// Has the effects of both [`Acquire`] and [`Release`] together:
231+ /// For loads it uses [`Acquire`] ordering. For stores it uses the [`Release`] ordering.
232+ ///
233+ /// Notice that in the case of `compare_and_swap`, it is possible that the operation ends up
234+ /// not performing any store and hence it has just `Acquire` ordering. However,
235+ /// `AcqRel` will never perform [`Relaxed`] accesses.
211236 ///
212237 /// This ordering is only applicable for operations that combine both loads and stores.
213238 ///
214- /// For loads it uses [`Acquire`] ordering. For stores it uses the [`Release `] ordering.
239+ /// Corresponds to LLVM's [`AcquireRelease `] ordering.
215240 ///
241+ /// [`AcquireRelease`]: http://llvm.org/docs/Atomics.html#acquirerelease
216242 /// [`Acquire`]: http://llvm.org/docs/Atomics.html#acquire
217243 /// [`Release`]: http://llvm.org/docs/Atomics.html#release
244+ /// [`Relaxed`]: https://llvm.org/docs/Atomics.html#monotonic
218245 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
219246 AcqRel ,
220- /// Like `AcqRel` with the additional guarantee that all threads see all
247+ /// Like [`Acquire`]/[`Release`]/[`AcqRel`] (for load, store, and load-with-store
248+ /// operations, respectively) with the additional guarantee that all threads see all
221249 /// sequentially consistent operations in the same order.
250+ ///
251+ /// Corresponds to LLVM's [`SequentiallyConsistent`] ordering.
252+ ///
253+ /// [`SequentiallyConsistent`]: http://llvm.org/docs/Atomics.html#sequentiallyconsistent
254+ /// [`Acquire`]: http://llvm.org/docs/Atomics.html#acquire
255+ /// [`Release`]: http://llvm.org/docs/Atomics.html#release
256+ /// [`AcqRel`]: https://llvm.org/docs/Atomics.html#acquirerelease
222257 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
223258 SeqCst ,
224259 // Prevent exhaustive matching to allow for future extension
@@ -384,9 +419,11 @@ impl AtomicBool {
384419 /// was updated.
385420 ///
386421 /// `compare_and_swap` also takes an [`Ordering`] argument which describes the memory
387- /// ordering of this operation.
422+ /// ordering of this operation. Notice that even when using [`AcqRel`], the operation
423+ /// might fail and hence just perform an `Acquire` load, but not have `Release` semantics.
388424 ///
389425 /// [`Ordering`]: enum.Ordering.html
426+ /// [`Ordering`]: enum.Ordering.html#variant.AcqRel
390427 /// [`bool`]: ../../../std/primitive.bool.html
391428 ///
392429 /// # Examples
@@ -421,7 +458,7 @@ impl AtomicBool {
421458 /// ordering of this operation. The first describes the required ordering if the
422459 /// operation succeeds while the second describes the required ordering when the
423460 /// operation fails. The failure ordering can't be [`Release`] or [`AcqRel`] and must
424- /// be equivalent or weaker than the success ordering.
461+ /// be equivalent to or weaker than the success ordering.
425462 ///
426463 /// [`bool`]: ../../../std/primitive.bool.html
427464 /// [`Ordering`]: enum.Ordering.html
0 commit comments