@@ -3,15 +3,15 @@ use core::future::Future;
33use alloc:: { boxed:: Box , sync:: Arc } ;
44
55use crate :: {
6- task:: { AsyncTask , AsyncTaskItem , BlankKernelTask } , task_id_alloc, TASK_MAP , TASK_QUEUE
6+ task:: { AsyncTask , AsyncTaskItem , BlankKernelTask } ,
7+ task_id_alloc, TASK_MAP , TASK_QUEUE ,
78} ;
89
910#[ inline]
10- pub fn spawn (
11- task : Arc < dyn AsyncTask > ,
12- future : impl Future < Output = ( ) > + Send + ' static ,
13- ) {
14- TASK_MAP . lock ( ) . insert ( task. get_task_id ( ) , Arc :: downgrade ( & task) ) ;
11+ pub fn spawn ( task : Arc < dyn AsyncTask > , future : impl Future < Output = ( ) > + Send + ' static ) {
12+ TASK_MAP
13+ . lock ( )
14+ . insert ( task. get_task_id ( ) , Arc :: downgrade ( & task) ) ;
1515 TASK_QUEUE . lock ( ) . push_back ( AsyncTaskItem {
1616 future : Box :: pin ( future) ,
1717 task,
@@ -21,7 +21,9 @@ pub fn spawn(
2121#[ inline]
2222pub fn spawn_blank ( future : impl Future < Output = ( ) > + Send + ' static ) {
2323 let task: Arc < dyn AsyncTask > = Arc :: new ( BlankKernelTask ( task_id_alloc ( ) ) ) ;
24- TASK_MAP . lock ( ) . insert ( task. get_task_id ( ) , Arc :: downgrade ( & task) ) ;
24+ TASK_MAP
25+ . lock ( )
26+ . insert ( task. get_task_id ( ) , Arc :: downgrade ( & task) ) ;
2527 TASK_QUEUE . lock ( ) . push_back ( AsyncTaskItem {
2628 future : Box :: pin ( future) ,
2729 task,
0 commit comments