diff options
| author | Mara Bos <m-ou.se@m-ou.se> | 2024-03-19 14:54:54 +0100 |
|---|---|---|
| committer | Mara Bos <m-ou.se@m-ou.se> | 2024-03-19 15:27:11 +0100 |
| commit | a2c74b8445001b7f6cfd1e333b29f21637ab2282 (patch) | |
| tree | de27674575e7de132c8966cf438f123ce9059a0d /library/core/src | |
| parent | f296c162d8c6f84bcfee99c152d4fd63aaef3e38 (diff) | |
| download | rust-a2c74b8445001b7f6cfd1e333b29f21637ab2282.tar.gz rust-a2c74b8445001b7f6cfd1e333b29f21637ab2282.zip | |
SeqCst->Relaxed in doc examples.
SeqCst is unnecessary here.
Diffstat (limited to 'library/core/src')
| -rw-r--r-- | library/core/src/alloc/global.rs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/library/core/src/alloc/global.rs b/library/core/src/alloc/global.rs index a1fff6707bd..8df3ace54ff 100644 --- a/library/core/src/alloc/global.rs +++ b/library/core/src/alloc/global.rs @@ -24,10 +24,7 @@ use crate::ptr; /// use std::alloc::{GlobalAlloc, Layout}; /// use std::cell::UnsafeCell; /// use std::ptr::null_mut; -/// use std::sync::atomic::{ -/// AtomicUsize, -/// Ordering::{Acquire, SeqCst}, -/// }; +/// use std::sync::atomic::{AtomicUsize, Ordering::Relaxed}; /// /// const ARENA_SIZE: usize = 128 * 1024; /// const MAX_SUPPORTED_ALIGN: usize = 4096; @@ -61,7 +58,7 @@ use crate::ptr; /// let mut allocated = 0; /// if self /// .remaining -/// .fetch_update(SeqCst, SeqCst, |mut remaining| { +/// .fetch_update(Relaxed, Relaxed, |mut remaining| { /// if size > remaining { /// return None; /// } @@ -81,7 +78,7 @@ use crate::ptr; /// /// fn main() { /// let _s = format!("allocating a string!"); -/// let currently = ALLOCATOR.remaining.load(Acquire); +/// let currently = ALLOCATOR.remaining.load(Relaxed); /// println!("allocated so far: {}", ARENA_SIZE - currently); /// } /// ``` |
