6
6
//! sense, this is structured more like various workers that are coordinating with devices, except
7
7
//! that we will use timeouts for the pauses.
8
8
9
- use core:: { future:: Future , pin:: Pin , task:: { Context , Poll } } ;
9
+ use core:: {
10
+ future:: Future ,
11
+ pin:: Pin ,
12
+ task:: { Context , Poll } ,
13
+ } ;
10
14
11
15
use alloc:: vec;
12
16
use alloc:: vec:: Vec ;
13
- use zephyr:: { kio:: { spawn, ContextExt } , printkln, sync:: { Arc , SpinMutex } , time:: Forever , work:: { futures:: JoinHandle , Signal , WorkQueue } } ;
17
+ use zephyr:: {
18
+ kio:: { spawn, ContextExt } ,
19
+ printkln,
20
+ sync:: { Arc , SpinMutex } ,
21
+ time:: Forever ,
22
+ work:: { futures:: JoinHandle , Signal , WorkQueue } ,
23
+ } ;
14
24
15
- use crate :: { get_random_delay, NUM_PHIL } ;
16
25
pub use crate :: Stats ;
26
+ use crate :: { get_random_delay, NUM_PHIL } ;
17
27
18
28
pub fn phil ( workq : & WorkQueue ) -> Manager {
19
29
let wake_manager = Arc :: new ( Signal :: new ( ) . unwrap ( ) ) ;
20
30
21
- let actions: Vec < _ > = ( 0 ..NUM_PHIL ) . map ( |_| Arc :: new ( Action :: new ( wake_manager. clone ( ) ) ) ) . collect ( ) ;
31
+ let actions: Vec < _ > = ( 0 ..NUM_PHIL )
32
+ . map ( |_| Arc :: new ( Action :: new ( wake_manager. clone ( ) ) ) )
33
+ . collect ( ) ;
22
34
23
35
let phils: Vec < _ > = ( 0 ..NUM_PHIL )
24
36
. map ( |i| Phil :: new ( actions[ i] . clone ( ) , i) )
@@ -57,7 +69,10 @@ pub struct Manager {
57
69
impl Future for Manager {
58
70
type Output = Stats ;
59
71
60
- fn poll ( mut self : core:: pin:: Pin < & mut Self > , cx : & mut core:: task:: Context < ' _ > ) -> core:: task:: Poll < Self :: Output > {
72
+ fn poll (
73
+ mut self : core:: pin:: Pin < & mut Self > ,
74
+ cx : & mut core:: task:: Context < ' _ > ,
75
+ ) -> core:: task:: Poll < Self :: Output > {
61
76
// Run through the actions, and see what they have to do.
62
77
printkln ! ( "Manager running" ) ;
63
78
@@ -66,7 +81,7 @@ impl Future for Manager {
66
81
67
82
// Loop through all of the actions.
68
83
for i in 0 ..self . actions . len ( ) {
69
- // for (i, act) in self.actions.iter().enumerate() {
84
+ // for (i, act) in self.actions.iter().enumerate() {
70
85
let act = & self . actions [ i] ;
71
86
let mut change = None ;
72
87
let mut lock = act. fork . lock ( ) . unwrap ( ) ;
0 commit comments