From c649f061c72af454199c5a2a9148c4867703da80 Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Fri, 26 Aug 2022 18:21:37 -0700 Subject: Use lock --- src/util/fifo_queue.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/util/fifo_queue.rs') diff --git a/src/util/fifo_queue.rs b/src/util/fifo_queue.rs index 779bc9d..bb3d8b1 100644 --- a/src/util/fifo_queue.rs +++ b/src/util/fifo_queue.rs @@ -2,6 +2,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; use crate::util::node::*; use core::fmt; @@ -20,7 +23,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 +34,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 } } } -- cgit v1.2.1