From d50d0fece79a59ac1148f1c8fb448b62aab32094 Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Fri, 26 Aug 2022 18:07:37 -0700 Subject: Use spin lock by default --- src/util/fifo_queue.rs | 8 ++++---- src/util/lifo_queue.rs | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/util/fifo_queue.rs b/src/util/fifo_queue.rs index 779bc9d..9c0874d 100644 --- a/src/util/fifo_queue.rs +++ b/src/util/fifo_queue.rs @@ -2,7 +2,7 @@ //! //! Provides the FIFO queue structure for allocations use crate::sync::interface::Mutex; -use crate::sync::NullLock; +use crate::sync::SpinLock; use crate::util::node::*; use core::fmt; use core::fmt::{Debug, Formatter}; @@ -20,7 +20,7 @@ macro_rules! init_fifo_queue { (@gen [$name:tt,$size:tt,$default:tt,$type:ty,$doc:expr]) => { #[doc = $doc] #[link_section = ".data.alloc"] - pub static $name: FifoQueue<'static, $type, {$size+1}> = FifoQueue::new(NullLock::new([Node::new($default); {$size+1}])); + pub static $name: FifoQueue<'static, $type, {$size+1}> = FifoQueue::new(SpinLock::new([Node::new($default); {$size+1}])); }; } @@ -31,12 +31,12 @@ pub struct FifoQueue<'a, T: Sized, const COUNT: usize> { /// # Synchronized Pool of items /// /// Stores synchronization wrapper around the data pool - pub inner: NullLock<[Node<'a, T>; COUNT]>, + pub inner: SpinLock<[Node<'a, T>; COUNT]>, } impl<'a, T: Sized, const COUNT: usize> FifoQueue<'a, T, COUNT> { /// # Create new Fifo Queue - pub const fn new(initial: NullLock<[Node<'a, T>; COUNT]>) -> Self { + pub const fn new(initial: SpinLock<[Node<'a, T>; COUNT]>) -> Self { Self { inner: initial } } } diff --git a/src/util/lifo_queue.rs b/src/util/lifo_queue.rs index d63ca6e..3a08076 100644 --- a/src/util/lifo_queue.rs +++ b/src/util/lifo_queue.rs @@ -2,7 +2,7 @@ //! //! Queue structure use crate::sync::interface::Mutex; -use crate::sync::NullLock; +use crate::sync::SpinLock; use crate::util::node::*; use core::fmt; use core::fmt::{Debug, Formatter}; @@ -20,7 +20,7 @@ macro_rules! init_lifo_queue { (@gen [$name:tt,$size:tt,$default:tt,$type:ty,$doc:expr]) => { #[doc = $doc] #[link_section = ".data.alloc"] - pub static $name: LifoQueue<'static, $type, {$size+1}> = LifoQueue::new(NullLock::new([Node::new($default); {$size+1}])); + pub static $name: LifoQueue<'static, $type, {$size+1}> = LifoQueue::new(SpinLock::new([Node::new($default); {$size+1}])); }; } @@ -31,12 +31,12 @@ pub struct LifoQueue<'a, T: Sized, const COUNT: usize> { /// # Synchronized Pool of items /// /// Stores synchronization wrapper around the data pool - pub inner: NullLock<[Node<'a, T>; COUNT]>, + pub inner: SpinLock<[Node<'a, T>; COUNT]>, } impl<'a, T: Sized, const COUNT: usize> LifoQueue<'a, T, COUNT> { /// # Create new Lifo Queue - pub const fn new(initial: NullLock<[Node<'a, T>; COUNT]>) -> Self { + pub const fn new(initial: SpinLock<[Node<'a, T>; COUNT]>) -> Self { Self { inner: initial } } } -- cgit v1.2.1