summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/sync.rs16
-rw-r--r--src/util/fifo_queue.rs4
-rw-r--r--src/util/lifo_queue.rs4
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};