Skip to content

Commit

Permalink
update linked_list version
Browse files Browse the repository at this point in the history
--------
TODO: Replace branch with the official version number

Signed-off-by: guoweikang <[email protected]>
  • Loading branch information
guoweikang committed Oct 16, 2024
1 parent c8d25d9 commit 876b579
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 42 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ repository = "https://github.com/arceos-org/scheduler"
documentation = "https://arceos-org.github.io/scheduler"

[dependencies]
linked_list = { git = "https://github.com/arceos-org/linked_list.git", tag = "v0.1.0" }
linked_list = { git = "https://github.com/arceos-org/linked_list.git", branch = "guoweikang/linked_list" }

43 changes: 2 additions & 41 deletions src/fifo.rs
Original file line number Diff line number Diff line change
@@ -1,49 +1,10 @@
use alloc::sync::Arc;
use core::ops::Deref;

use linked_list::{Adapter, Links, List};
use linked_list::{def_generic_node, List};

use crate::BaseScheduler;

/// A task wrapper for the [`FifoScheduler`].
///
/// It add extra states to use in [`linked_list::List`].
pub struct FifoTask<T> {
inner: T,
links: Links<Self>,
}

unsafe impl<T> Adapter for FifoTask<T> {
type EntryType = Self;

#[inline]
fn to_links(t: &Self) -> &Links<Self> {
&t.links
}
}

impl<T> FifoTask<T> {
/// Creates a new [`FifoTask`] from the inner task struct.
pub const fn new(inner: T) -> Self {
Self {
inner,
links: Links::new(),
}
}

/// Returns a reference to the inner task struct.
pub const fn inner(&self) -> &T {
&self.inner
}
}

impl<T> Deref for FifoTask<T> {
type Target = T;
#[inline]
fn deref(&self) -> &Self::Target {
&self.inner
}
}
def_generic_node!(FifoTask);

/// A simple FIFO (First-In-First-Out) cooperative scheduler.
///
Expand Down

0 comments on commit 876b579

Please sign in to comment.