diff options
| author | Christian Cunningham <c@localhost> | 2022-08-26 18:57:39 -0700 |
|---|---|---|
| committer | Christian Cunningham <c@localhost> | 2022-08-26 18:57:39 -0700 |
| commit | 07e7347e4abde7260b8fcfd886a2509197f06c65 (patch) | |
| tree | e72071e67568a575ae087846de5d5a3beb0c09ea | |
| parent | e05010f85baa4c3fd989dd623534051b24a15971 (diff) | |
*cargo fmt
| -rw-r--r-- | src/sync.rs | 16 | ||||
| -rw-r--r-- | src/util/fifo_queue.rs | 4 | ||||
| -rw-r--r-- | src/util/lifo_queue.rs | 4 |
3 files changed, 16 insertions, 8 deletions
diff --git a/src/sync.rs b/src/sync.rs index 64d3326..00d4d39 100644 --- a/src/sync.rs +++ b/src/sync.rs @@ -122,11 +122,19 @@ impl<T> interface::Mutex for SpinLock<T> { fn lock<'a, R>(&'a self, f: impl FnOnce(&'a mut T) -> R) -> R { loop { // Loop until acquired the lock - match self.lock - .compare_exchange(false, true, Ordering::Acquire, Ordering::Acquire) + match self + .lock + .compare_exchange(false, true, Ordering::Acquire, Ordering::Acquire) { - Ok(false) => { break; } - _ => {} + Ok(false) => { + break; + } + Ok(true) => { + break; + } + Err(true) => { + break; + } } } let data = unsafe { &mut *self.data.get() }; diff --git a/src/util/fifo_queue.rs b/src/util/fifo_queue.rs index bb3d8b1..41431a5 100644 --- a/src/util/fifo_queue.rs +++ b/src/util/fifo_queue.rs @@ -3,9 +3,9 @@ //! Provides the FIFO queue structure for allocations use crate::sync::interface::Mutex; #[allow(unused_imports)] -use crate::sync::SpinLock; -#[allow(unused_imports)] use crate::sync::NullLock; +#[allow(unused_imports)] +use crate::sync::SpinLock; use crate::util::node::*; use core::fmt; use core::fmt::{Debug, Formatter}; diff --git a/src/util/lifo_queue.rs b/src/util/lifo_queue.rs index cb0648b..5c626f3 100644 --- a/src/util/lifo_queue.rs +++ b/src/util/lifo_queue.rs @@ -3,9 +3,9 @@ //! Queue structure use crate::sync::interface::Mutex; #[allow(unused_imports)] -use crate::sync::SpinLock; -#[allow(unused_imports)] use crate::sync::NullLock; +#[allow(unused_imports)] +use crate::sync::SpinLock; use crate::util::node::*; use core::fmt; use core::fmt::{Debug, Formatter}; |
