aboutsummaryrefslogtreecommitdiff
path: root/rtic-common
diff options
context:
space:
mode:
authordatdenkikniet <jcdra1@gmail.com>2023-04-13 21:17:19 +0200
committerdatdenkikniet <jcdra1@gmail.com>2023-04-15 19:19:49 +0200
commit68ccf0423d27041c35002f9a86bb0e764e3782b3 (patch)
tree885043a0b94cbd75205b66d4c1e6a6029e0aca7d /rtic-common
parent068eea84256f5b8b6152ca0ae1ad46301fe64b12 (diff)
rtic-common: rename LinkedList to DoublyLinkedList
Diffstat (limited to 'rtic-common')
-rw-r--r--rtic-common/src/wait_queue.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/rtic-common/src/wait_queue.rs b/rtic-common/src/wait_queue.rs
index 3056672..4b1b0f3 100644
--- a/rtic-common/src/wait_queue.rs
+++ b/rtic-common/src/wait_queue.rs
@@ -8,18 +8,18 @@ use core::task::Waker;
use critical_section as cs;
/// A helper definition of a wait queue.
-pub type WaitQueue = LinkedList<Waker>;
+pub type WaitQueue = DoublyLinkedList<Waker>;
/// An atomic, doubly linked, FIFO list for a wait queue.
///
/// Atomicity is guaranteed by short [`critical_section`]s, so this list is _not_ lock free,
/// but it will not deadlock.
-pub struct LinkedList<T> {
+pub struct DoublyLinkedList<T> {
head: AtomicPtr<Link<T>>, // UnsafeCell<*mut Link<T>>
tail: AtomicPtr<Link<T>>,
}
-impl<T> LinkedList<T> {
+impl<T> DoublyLinkedList<T> {
/// Create a new linked list.
pub const fn new() -> Self {
Self {
@@ -29,7 +29,7 @@ impl<T> LinkedList<T> {
}
}
-impl<T: Clone> LinkedList<T> {
+impl<T: Clone> DoublyLinkedList<T> {
const R: Ordering = Ordering::Relaxed;
/// Pop the first element in the queue.
@@ -133,7 +133,7 @@ impl<T: Clone> Link<T> {
}
/// Remove this link from a linked list.
- pub fn remove_from_list(&self, list: &LinkedList<T>) {
+ pub fn remove_from_list(&self, list: &DoublyLinkedList<T>) {
cs::with(|_| {
// Make sure all previous writes are visible
core::sync::atomic::fence(Ordering::SeqCst);
@@ -175,7 +175,7 @@ impl<T: Clone> Link<T> {
}
#[cfg(test)]
-impl<T: core::fmt::Debug + Clone> LinkedList<T> {
+impl<T: core::fmt::Debug + Clone> DoublyLinkedList<T> {
fn print(&self) {
cs::with(|_| {
// Make sure all previous writes are visible
@@ -235,7 +235,7 @@ mod tests {
#[test]
fn linked_list() {
- let wq = LinkedList::<u32>::new();
+ let wq = DoublyLinkedList::<u32>::new();
let i1 = Link::new(10);
let i2 = Link::new(11);