@@ -6,11 +6,11 @@ use std::sync::Arc;
66use  std:: task:: { RawWaker ,  RawWakerVTable } ; 
77use  std:: thread:: { self ,  Thread } ; 
88
9- use  super :: pool ; 
9+ use  super :: local ; 
1010use  super :: task; 
11+ use  super :: worker; 
1112use  crate :: future:: Future ; 
1213use  crate :: task:: { Context ,  Poll ,  Waker } ; 
13- use  crate :: utils:: abort_on_panic; 
1414
1515use  kv_log_macro:: trace; 
1616
@@ -58,39 +58,36 @@ where
5858
5959        // Log this `block_on` operation. 
6060        let  child_id = tag. task_id ( ) . as_u64 ( ) ; 
61-         let  parent_id = pool :: get_task ( |t| t. id ( ) . as_u64 ( ) ) . unwrap_or ( 0 ) ; 
61+         let  parent_id = worker :: get_task ( |t| t. id ( ) . as_u64 ( ) ) . unwrap_or ( 0 ) ; 
6262
6363        trace ! ( "block_on" ,  { 
6464            parent_id:  parent_id, 
6565            child_id:  child_id, 
6666        } ) ; 
6767
6868        // Wrap the future into one that drops task-local variables on exit. 
69+         let  future = local:: add_finalizer ( future) ; 
70+ 
6971        let  future = async  move  { 
7072            let  res = future. await ; 
71- 
72-             // Abort on panic because thread-local variables behave the same way. 
73-             abort_on_panic ( || pool:: get_task ( |task| task. metadata ( ) . local_map . clear ( ) ) ) ; 
74- 
7573            trace ! ( "block_on completed" ,  { 
7674                parent_id:  parent_id, 
7775                child_id:  child_id, 
7876            } ) ; 
79- 
8077            res
8178        } ; 
8279
8380        // Pin the future onto the stack. 
8481        pin_utils:: pin_mut!( future) ; 
8582
86-         // Transmute the future into one that is static . 
83+         // Transmute the future into one that is futurestatic . 
8784        let  future = mem:: transmute :: < 
8885            Pin < & ' _  mut  dyn  Future < Output  = ( ) > > , 
8986            Pin < & ' static  mut  dyn  Future < Output  = ( ) > > , 
9087        > ( future) ; 
9188
9289        // Block on the future and and wait for it to complete. 
93-         pool :: set_tag ( & tag,  || block ( future) ) ; 
90+         worker :: set_tag ( & tag,  || block ( future) ) ; 
9491
9592        // Take out the result. 
9693        match  ( * out. get ( ) ) . take ( ) . unwrap ( )  { 
0 commit comments