From 80df9aec1db449e6cc0f4513103aa442b8d43de3 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Fri, 5 Jul 2024 17:53:09 -0400 Subject: refactor: move `FileCollector` to deno_config (#24433) --- cli/util/sync/atomic_flag.rs | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 cli/util/sync/atomic_flag.rs (limited to 'cli/util/sync/atomic_flag.rs') diff --git a/cli/util/sync/atomic_flag.rs b/cli/util/sync/atomic_flag.rs deleted file mode 100644 index 75396dcf4..000000000 --- a/cli/util/sync/atomic_flag.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. - -use std::sync::atomic::AtomicBool; -use std::sync::atomic::Ordering; - -/// Simplifies the use of an atomic boolean as a flag. -#[derive(Debug, Default)] -pub struct AtomicFlag(AtomicBool); - -impl AtomicFlag { - /// Raises the flag returning if the raise was successful. - pub fn raise(&self) -> bool { - !self.0.swap(true, Ordering::SeqCst) - } - - /// Gets if the flag is raised. - pub fn is_raised(&self) -> bool { - self.0.load(Ordering::SeqCst) - } -} - -#[cfg(test)] -mod test { - use super::*; - - #[test] - fn atomic_flag_raises() { - let flag = AtomicFlag::default(); - assert!(!flag.is_raised()); // false by default - assert!(flag.raise()); - assert!(flag.is_raised()); - assert!(!flag.raise()); - assert!(flag.is_raised()); - } -} -- cgit v1.2.3