SeqCst->Relaxed in doc examples.

SeqCst is unnecessary here.
This commit is contained in:
Mara Bos 2024-03-19 14:54:54 +01:00
parent f296c162d8
commit a2c74b8445
2 changed files with 4 additions and 7 deletions

View File

@ -233,7 +233,7 @@ macro_rules! acquire {
/// let val = Arc::clone(&val);
///
/// thread::spawn(move || {
/// let v = val.fetch_add(1, Ordering::SeqCst);
/// let v = val.fetch_add(1, Ordering::Relaxed);
/// println!("{v:?}");
/// });
/// }

View File

@ -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);
/// }
/// ```