File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11[package ]
22name = " scheduler"
3- version = " 0.1 .0"
3+ version = " 0.2 .0"
44edition = " 2021"
55authors = [" Yuekai Jia <equation618@gmail.com>" ]
66description = " Various scheduler algorithms in a unified interface"
@@ -10,5 +10,4 @@ repository = "https://github.com/arceos-org/scheduler"
1010documentation = " 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" }
Original file line number Diff line number Diff line change 11use 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
65use 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.
You can’t perform that action at this time.
0 commit comments