(task: Arc<dyn Task>)
| 12 | |
| 13 | impl TaskContext { |
| 14 | pub fn spawn_new_task(task: Arc<dyn Task>) -> TaskContext { |
| 15 | let span = Span::current(); |
| 16 | |
| 17 | let task_handle = tokio_utils::launch_blocking_task({ |
| 18 | let task = task.clone(); |
| 19 | move || { |
| 20 | let _guard = scopeguard::guard(span, |span| { |
| 21 | let _span = span.enter(); |
| 22 | debug!("Task {} has terminated to run from blocking pool", task.id()); |
| 23 | }); |
| 24 | |
| 25 | task.run(); |
| 26 | } |
| 27 | }); |
| 28 | |
| 29 | TaskContext { |
| 30 | task, |
| 31 | _handle: task_handle, |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | pub async fn terminate_task(self) { |
| 36 | if self.task.is_terminated() { |
nothing calls this directly
no test coverage detected