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
Copy file name to clipboardExpand all lines: src/concurrency.md
+28-1Lines changed: 28 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -107,7 +107,7 @@ fn main() {
107
107
```
108
108
109
109
r[concurrency.atomics.thread-safety]
110
-
Atomic operations are guaranteed to be indivisible: no other thread can observe a value half-written or perform a conflicting update in the middle of an atomic operation. Correct use of atomic types can prevent [data races], but misuse may still cause higher-level concurrency bugs such as deadlocks or livelocks.
110
+
Atomic operations are guaranteed to be indivisible: no other thread can observe a value half---written or perform a conflicting update in the middle of an atomic operation. Correct use of atomic types can prevent [data races], but misuse may still cause higher---level concurrency bugs such as deadlocks or livelocks.
111
111
112
112
```rust
113
113
usestd::sync::atomic::{AtomicUsize, Ordering};
@@ -145,6 +145,33 @@ The following table lists the atomic types and the corresponding primitive types
145
145
|`usize`|[`core::sync::atomic::AtomicUsize`]|
146
146
|`*mut T`|[`core::sync::atomic::AtomicPtr<T>`]|
147
147
148
+
r[concurrency.atomics.usage]
149
+
Atomic types are [`Sync`], meaning references to them can be safely shared between threads. Using atomic operations correctly may require careful reasoning about memory ordering.
0 commit comments