@@ -32,17 +32,6 @@ use model::{
3232 progress_event_record, progress_wait_reason, push_task_event, task_dir, terminal_event_record,
3333} ;
3434
35- /// Own an adopted task rather than detaching it when its wrapper is aborted.
36- /// Construct before the first await, including before spawning the wrapper, so
37- /// cancellation during registration or before its first poll is also safe.
38- struct AbortAdoptedTask < T > ( JoinHandle < T > ) ;
39-
40- impl < T > Drop for AbortAdoptedTask < T > {
41- fn drop ( & mut self ) {
42- self . 0 . abort ( ) ;
43- }
44- }
45-
4635/// Manages background task execution
4736pub struct BackgroundTaskManager {
4837 tasks : Arc < RwLock < HashMap < String , RunningTask > > > ,
@@ -659,7 +648,7 @@ impl BackgroundTaskManager {
659648 wake : bool ,
660649 handle : JoinHandle < Result < jcode_tool_types:: ToolOutput > > ,
661650 ) -> BackgroundTaskInfo {
662- let mut handle = AbortAdoptedTask ( handle) ;
651+ let mut handle = model :: AbortAdoptedTask ( handle) ;
663652 // Reserve before the foreground caller can release its turn/tool guard.
664653 let runtime_activity = crate :: runtime_activity:: global ( ) . enter ( ) . await ;
665654 let ( notify, wake) = normalize_delivery ( notify, wake) ;
@@ -716,7 +705,6 @@ impl BackgroundTaskManager {
716705 let ( delivery_flags_tx, delivery_flags_rx) = watch:: channel ( ( notify, wake) ) ;
717706 let tasks_for_prune = Arc :: clone ( & self . tasks ) ;
718707 let ( registered_tx, registered_rx) = tokio:: sync:: oneshot:: channel :: < ( ) > ( ) ;
719-
720708 let wrapper_handle = tokio:: spawn ( async move {
721709 let _runtime_activity = runtime_activity;
722710 let tool_result = ( & mut handle. 0 ) . await ;
0 commit comments