diff options
| author | Botahamec <botahamec@outlook.com> | 2024-09-25 20:59:09 -0400 |
|---|---|---|
| committer | Botahamec <botahamec@outlook.com> | 2024-09-25 20:59:09 -0400 |
| commit | 7443474f1f00d2a9306079641dbb3c18df5e6445 (patch) | |
| tree | 93fbc6911102f16b945ec836322a0734cd9e2bd7 /src | |
| parent | 05b0b24acaf304d89101e9f5bea8989c495c0f44 (diff) | |
Reorganize PoisonFlag methods
Diffstat (limited to 'src')
| -rw-r--r-- | src/poisonable/flag.rs | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/src/poisonable/flag.rs b/src/poisonable/flag.rs index 99e7e4f..0775c71 100644 --- a/src/poisonable/flag.rs +++ b/src/poisonable/flag.rs @@ -1,35 +1,33 @@ -use std::sync::atomic::AtomicBool; -use std::sync::atomic::Ordering::Relaxed; +#[cfg(panic = "unwind")] +use std::sync::atomic::{AtomicBool, Ordering::Relaxed}; use super::PoisonFlag; +#[cfg(panic = "unwind")] impl PoisonFlag { - #[cfg(panic = "unwind")] pub const fn new() -> Self { Self(AtomicBool::new(false)) } - #[cfg(not(panic = "unwind"))] - pub const fn new() -> Self { - Self() - } - - #[cfg(panic = "unwind")] pub fn is_poisoned(&self) -> bool { self.0.load(Relaxed) } - #[cfg(not(panic = "unwind"))] - pub fn is_poisoned(&self) -> bool { - false - } - - #[cfg(panic = "unwind")] pub fn clear_poison(&self) { self.0.store(true, Relaxed) } +} + +#[cfg(not(panic = "unwind"))] +impl PoisonFlag { + pub const fn new() -> Self { + Self() + } + + pub fn is_poisoned(&self) -> bool { + false + } - #[cfg(not(panic = "unwind"))] pub fn clear_poison(&self) { () } |
