@@ -448,6 +448,12 @@ pub unsafe fn write_unaligned<T>(dst: *mut T, src: T) {
448
448
/// `write_bytes`, or `copy`). Note that `*src = foo` counts as a use
449
449
/// because it will attempt to drop the value previously at `*src`.
450
450
///
451
+ /// Just like in C, whether an operation is volatile has no bearing whatsoever
452
+ /// on questions involving concurrent access from multiple threads. Volatile
453
+ /// accesses behave exactly like non-atomic accesses in that regard. In particular,
454
+ /// a race between a `read_volatile` and any write operation to the same location
455
+ /// is undefined behavior.
456
+ ///
451
457
/// # Examples
452
458
///
453
459
/// Basic usage:
@@ -498,6 +504,12 @@ pub unsafe fn read_volatile<T>(src: *const T) -> T {
498
504
/// This is appropriate for initializing uninitialized memory, or overwriting
499
505
/// memory that has previously been `read` from.
500
506
///
507
+ /// Just like in C, whether an operation is volatile has no bearing whatsoever
508
+ /// on questions involving concurrent access from multiple threads. Volatile
509
+ /// accesses behave exactly like non-atomic accesses in that regard. In particular,
510
+ /// a race between a `write_volatile` and any other operation (reading or writing)
511
+ /// on the same location is undefined behavior.
512
+ ///
501
513
/// # Examples
502
514
///
503
515
/// Basic usage:
@@ -1057,6 +1069,12 @@ impl<T: ?Sized> *const T {
1057
1069
/// `write_bytes`, or `copy`). Note that `*self = foo` counts as a use
1058
1070
/// because it will attempt to drop the value previously at `*self`.
1059
1071
///
1072
+ /// Just like in C, whether an operation is volatile has no bearing whatsoever
1073
+ /// on questions involving concurrent access from multiple threads. Volatile
1074
+ /// accesses behave exactly like non-atomic accesses in that regard. In particular,
1075
+ /// a race between a `read_volatile` and any write operation to the same location
1076
+ /// is undefined behavior.
1077
+ ///
1060
1078
/// # Examples
1061
1079
///
1062
1080
/// Basic usage:
@@ -1790,6 +1808,12 @@ impl<T: ?Sized> *mut T {
1790
1808
/// `write_bytes`, or `copy`). Note that `*self = foo` counts as a use
1791
1809
/// because it will attempt to drop the value previously at `*self`.
1792
1810
///
1811
+ /// Just like in C, whether an operation is volatile has no bearing whatsoever
1812
+ /// on questions involving concurrent access from multiple threads. Volatile
1813
+ /// accesses behave exactly like non-atomic accesses in that regard. In particular,
1814
+ /// a race between a `read_volatile` and any write operation to the same location
1815
+ /// is undefined behavior.
1816
+ ///
1793
1817
/// # Examples
1794
1818
///
1795
1819
/// Basic usage:
@@ -2105,6 +2129,12 @@ impl<T: ?Sized> *mut T {
2105
2129
/// This is appropriate for initializing uninitialized memory, or overwriting
2106
2130
/// memory that has previously been `read` from.
2107
2131
///
2132
+ /// Just like in C, whether an operation is volatile has no bearing whatsoever
2133
+ /// on questions involving concurrent access from multiple threads. Volatile
2134
+ /// accesses behave exactly like non-atomic accesses in that regard. In particular,
2135
+ /// a race between a `write_volatile` and any other operation (reading or writing)
2136
+ /// on the same location is undefined behavior.
2137
+ ///
2108
2138
/// # Examples
2109
2139
///
2110
2140
/// Basic usage:
0 commit comments