Skip to content

Commit 33e851e

Browse files
authored
Merge pull request #2 from arceos-org/guoweikang/update_list
update linked_list version
2 parents c8d25d9 + 076f3e1 commit 33e851e

File tree

2 files changed

+8
-43
lines changed

2 files changed

+8
-43
lines changed

Cargo.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "scheduler"
3-
version = "0.1.0"
3+
version = "0.2.0"
44
edition = "2021"
55
authors = ["Yuekai Jia <equation618@gmail.com>"]
66
description = "Various scheduler algorithms in a unified interface"
@@ -10,5 +10,4 @@ repository = "https://github.com/arceos-org/scheduler"
1010
documentation = "https://arceos-org.github.io/scheduler"
1111

1212
[dependencies]
13-
linked_list = { git = "https://github.com/arceos-org/linked_list.git", tag = "v0.1.0" }
14-
13+
linked_list_r4l = { version = "0.2.0" }

src/fifo.rs

Lines changed: 6 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,14 @@
11
use alloc::sync::Arc;
2-
use core::ops::Deref;
32

4-
use linked_list::{Adapter, Links, List};
3+
use linked_list_r4l::{def_node, List};
54

65
use crate::BaseScheduler;
76

8-
/// A task wrapper for the [`FifoScheduler`].
9-
///
10-
/// It add extra states to use in [`linked_list::List`].
11-
pub struct FifoTask<T> {
12-
inner: T,
13-
links: Links<Self>,
14-
}
15-
16-
unsafe impl<T> Adapter for FifoTask<T> {
17-
type EntryType = Self;
18-
19-
#[inline]
20-
fn to_links(t: &Self) -> &Links<Self> {
21-
&t.links
22-
}
23-
}
24-
25-
impl<T> FifoTask<T> {
26-
/// Creates a new [`FifoTask`] from the inner task struct.
27-
pub const fn new(inner: T) -> Self {
28-
Self {
29-
inner,
30-
links: Links::new(),
31-
}
32-
}
33-
34-
/// Returns a reference to the inner task struct.
35-
pub const fn inner(&self) -> &T {
36-
&self.inner
37-
}
38-
}
39-
40-
impl<T> Deref for FifoTask<T> {
41-
type Target = T;
42-
#[inline]
43-
fn deref(&self) -> &Self::Target {
44-
&self.inner
45-
}
7+
def_node! {
8+
/// A task wrapper for the [`FifoScheduler`].
9+
///
10+
/// It add extra states to use in [`linked_list::List`].
11+
pub struct FifoTask<T>(T);
4612
}
4713

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

0 commit comments

Comments
 (0)