Skip to content

Commit 1733bd3

Browse files
committed
list possible orderings for load and store
1 parent 110bcc9 commit 1733bd3

File tree

1 file changed

+43
-26
lines changed

1 file changed

+43
-26
lines changed

src/libcore/sync/atomic.rs

+43-26
Original file line numberDiff line numberDiff line change
@@ -332,15 +332,18 @@ impl AtomicBool {
332332
/// Loads a value from the bool.
333333
///
334334
/// `load` takes an [`Ordering`] argument which describes the memory ordering
335-
/// of this operation.
335+
/// of this operation. Possible values are [`SeqCst`], [`Acquire`] and [`Relaxed`].
336336
///
337337
/// # Panics
338338
///
339339
/// Panics if `order` is [`Release`] or [`AcqRel`].
340340
///
341341
/// [`Ordering`]: enum.Ordering.html
342+
/// [`Relaxed`]: enum.Ordering.html#variant.Relaxed
342343
/// [`Release`]: enum.Ordering.html#variant.Release
344+
/// [`Acquire`]: enum.Ordering.html#variant.Acquire
343345
/// [`AcqRel`]: enum.Ordering.html#variant.AcqRel
346+
/// [`SeqCst`]: enum.Ordering.html#variant.SeqCst
344347
///
345348
/// # Examples
346349
///
@@ -360,9 +363,18 @@ impl AtomicBool {
360363
/// Stores a value into the bool.
361364
///
362365
/// `store` takes an [`Ordering`] argument which describes the memory ordering
363-
/// of this operation.
366+
/// of this operation. Possible values are [`SeqCst`], [`Release`] and [`Relaxed`].
367+
///
368+
/// # Panics
369+
///
370+
/// Panics if `order` is [`Acquire`] or [`AcqRel`].
364371
///
365372
/// [`Ordering`]: enum.Ordering.html
373+
/// [`Relaxed`]: enum.Ordering.html#variant.Relaxed
374+
/// [`Release`]: enum.Ordering.html#variant.Release
375+
/// [`Acquire`]: enum.Ordering.html#variant.Acquire
376+
/// [`AcqRel`]: enum.Ordering.html#variant.AcqRel
377+
/// [`SeqCst`]: enum.Ordering.html#variant.SeqCst
366378
///
367379
/// # Examples
368380
///
@@ -374,13 +386,6 @@ impl AtomicBool {
374386
/// some_bool.store(false, Ordering::Relaxed);
375387
/// assert_eq!(some_bool.load(Ordering::Relaxed), false);
376388
/// ```
377-
///
378-
/// # Panics
379-
///
380-
/// Panics if `order` is [`Acquire`] or [`AcqRel`].
381-
///
382-
/// [`Acquire`]: enum.Ordering.html#variant.Acquire
383-
/// [`AcqRel`]: enum.Ordering.html#variant.AcqRel
384389
#[inline]
385390
#[stable(feature = "rust1", since = "1.0.0")]
386391
pub fn store(&self, val: bool, order: Ordering) {
@@ -751,15 +756,18 @@ impl<T> AtomicPtr<T> {
751756
/// Loads a value from the pointer.
752757
///
753758
/// `load` takes an [`Ordering`] argument which describes the memory ordering
754-
/// of this operation.
759+
/// of this operation. Possible values are [`SeqCst`], [`Acquire`] and [`Relaxed`].
755760
///
756761
/// # Panics
757762
///
758763
/// Panics if `order` is [`Release`] or [`AcqRel`].
759764
///
760765
/// [`Ordering`]: enum.Ordering.html
766+
/// [`Relaxed`]: enum.Ordering.html#variant.Relaxed
761767
/// [`Release`]: enum.Ordering.html#variant.Release
768+
/// [`Acquire`]: enum.Ordering.html#variant.Acquire
762769
/// [`AcqRel`]: enum.Ordering.html#variant.AcqRel
770+
/// [`SeqCst`]: enum.Ordering.html#variant.SeqCst
763771
///
764772
/// # Examples
765773
///
@@ -780,9 +788,18 @@ impl<T> AtomicPtr<T> {
780788
/// Stores a value into the pointer.
781789
///
782790
/// `store` takes an [`Ordering`] argument which describes the memory ordering
783-
/// of this operation.
791+
/// of this operation. Possible values are [`SeqCst`], [`Release`] and [`Relaxed`].
792+
///
793+
/// # Panics
794+
///
795+
/// Panics if `order` is [`Acquire`] or [`AcqRel`].
784796
///
785797
/// [`Ordering`]: enum.Ordering.html
798+
/// [`Relaxed`]: enum.Ordering.html#variant.Relaxed
799+
/// [`Release`]: enum.Ordering.html#variant.Release
800+
/// [`Acquire`]: enum.Ordering.html#variant.Acquire
801+
/// [`AcqRel`]: enum.Ordering.html#variant.AcqRel
802+
/// [`SeqCst`]: enum.Ordering.html#variant.SeqCst
786803
///
787804
/// # Examples
788805
///
@@ -796,13 +813,6 @@ impl<T> AtomicPtr<T> {
796813
///
797814
/// some_ptr.store(other_ptr, Ordering::Relaxed);
798815
/// ```
799-
///
800-
/// # Panics
801-
///
802-
/// Panics if `order` is [`Acquire`] or [`AcqRel`].
803-
///
804-
/// [`Acquire`]: enum.Ordering.html#variant.Acquire
805-
/// [`AcqRel`]: enum.Ordering.html#variant.AcqRel
806816
#[inline]
807817
#[stable(feature = "rust1", since = "1.0.0")]
808818
pub fn store(&self, ptr: *mut T, order: Ordering) {
@@ -1115,14 +1125,18 @@ assert_eq!(some_var.into_inner(), 5);
11151125
concat!("Loads a value from the atomic integer.
11161126
11171127
`load` takes an [`Ordering`] argument which describes the memory ordering of this operation.
1128+
Possible values are [`SeqCst`], [`Acquire`] and [`Relaxed`].
11181129
11191130
# Panics
11201131
11211132
Panics if `order` is [`Release`] or [`AcqRel`].
11221133
11231134
[`Ordering`]: enum.Ordering.html
1135+
[`Relaxed`]: enum.Ordering.html#variant.Relaxed
11241136
[`Release`]: enum.Ordering.html#variant.Release
1137+
[`Acquire`]: enum.Ordering.html#variant.Acquire
11251138
[`AcqRel`]: enum.Ordering.html#variant.AcqRel
1139+
[`SeqCst`]: enum.Ordering.html#variant.SeqCst
11261140
11271141
# Examples
11281142
@@ -1144,8 +1158,18 @@ assert_eq!(some_var.load(Ordering::Relaxed), 5);
11441158
concat!("Stores a value into the atomic integer.
11451159
11461160
`store` takes an [`Ordering`] argument which describes the memory ordering of this operation.
1161+
Possible values are [`SeqCst`], [`Release`] and [`Relaxed`].
1162+
1163+
# Panics
1164+
1165+
Panics if `order` is [`Acquire`] or [`AcqRel`].
11471166
11481167
[`Ordering`]: enum.Ordering.html
1168+
[`Relaxed`]: enum.Ordering.html#variant.Relaxed
1169+
[`Release`]: enum.Ordering.html#variant.Release
1170+
[`Acquire`]: enum.Ordering.html#variant.Acquire
1171+
[`AcqRel`]: enum.Ordering.html#variant.AcqRel
1172+
[`SeqCst`]: enum.Ordering.html#variant.SeqCst
11491173
11501174
# Examples
11511175
@@ -1156,14 +1180,7 @@ let some_var = ", stringify!($atomic_type), "::new(5);
11561180
11571181
some_var.store(10, Ordering::Relaxed);
11581182
assert_eq!(some_var.load(Ordering::Relaxed), 10);
1159-
```
1160-
1161-
# Panics
1162-
1163-
Panics if `order` is [`Acquire`] or [`AcqRel`].
1164-
1165-
[`Acquire`]: enum.Ordering.html#variant.Acquire
1166-
[`AcqRel`]: enum.Ordering.html#variant.AcqRel"),
1183+
```"),
11671184
#[inline]
11681185
#[$stable]
11691186
pub fn store(&self, val: $int_type, order: Ordering) {

0 commit comments

Comments
 (0)