Skip to content
Myr

Change test suite atomic from SeqCst to Relaxed

Before adoption: this commit came in with the history the project adopted, so no landing records it.

This atomic is not synchronizing anything outside of its own value, so we don't need the Acquire/Release guarantee that all memory operations prior to the store are visible after the subsequent load, nor the SeqCst guarantee of all threads seeing all of the sequentially consistent operations in the same order.

authored by David Tolnay · committed by David Tolnay · parent 42badfd · Browse files · 1 file+3 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+3 added−4 removed

  • tests:+3 added−4 removed

1 file+3 added−4 removed

modified:tests/drop/mod.rs+3 added-4 removed
1#![allow(clippy::module_name_repetitions)]23use std::error::Error as StdError;4use std::fmt::{self, Display};5use std::sync::atomic::AtomicBool;6use std::sync::atomic::Ordering::SeqCst;5use std::sync::atomic::{AtomicBool, Ordering};6use std::sync::Arc;78#[derive(Debug)]9pub struct Flag {
7 unmodified lines
17 }18 }1920 pub fn get(&self) -> bool {22 self.atomic.load(SeqCst)21 self.atomic.load(Ordering::Relaxed)22 }23}2425#[derive(Debug)]
20 unmodified lines
46}4748impl Drop for DetectDrop {49 fn drop(&mut self) {51 let already_dropped = self.has_dropped.atomic.swap(true, SeqCst);50 let already_dropped = self.has_dropped.atomic.swap(true, Ordering::Relaxed);51 assert!(!already_dropped);52 }53}