File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ pub(crate) mod vsock;
9
9
use alloc:: sync:: Arc ;
10
10
use alloc:: task:: Wake ;
11
11
use core:: future:: Future ;
12
- use core:: pin:: pin;
12
+ use core:: pin:: { Pin , pin} ;
13
13
use core:: sync:: atomic:: AtomicU32 ;
14
14
use core:: task:: { Context , Poll , Waker } ;
15
15
use core:: time:: Duration ;
@@ -102,7 +102,7 @@ pub(crate) fn run() {
102
102
let mut task = { core_local:: async_tasks ( ) . pop_front ( ) . unwrap ( ) } ;
103
103
trace ! ( "Run async task {}" , task. id( ) ) ;
104
104
105
- if task. poll ( & mut cx) . is_pending ( ) {
105
+ if Pin :: new ( & mut task) . poll ( & mut cx) . is_pending ( ) {
106
106
core_local:: async_tasks ( ) . push_back ( task) ;
107
107
}
108
108
}
Original file line number Diff line number Diff line change @@ -39,8 +39,12 @@ impl AsyncTask {
39
39
pub fn id ( & self ) -> AsyncTaskId {
40
40
self . id
41
41
}
42
+ }
43
+
44
+ impl Future for AsyncTask {
45
+ type Output = ( ) ;
42
46
43
- pub fn poll ( & mut self , context : & mut Context < ' _ > ) -> Poll < ( ) > {
44
- self . future . as_mut ( ) . poll ( context )
47
+ fn poll ( mut self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Self :: Output > {
48
+ self . as_mut ( ) . future . as_mut ( ) . poll ( cx )
45
49
}
46
50
}
You can’t perform that action at this time.
0 commit comments