Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rt: implement initial set of task hooks #6742

Merged
merged 12 commits into from
Aug 27, 2024
Prev Previous commit
move catch_unwind inside if-else check
Noah-Kennedy committed Aug 23, 2024
commit ac675fc9129340019a62fdae255fb01ce0f8fb4c
8 changes: 4 additions & 4 deletions tokio/src/runtime/task/harness.rs
Original file line number Diff line number Diff line change
@@ -334,15 +334,15 @@ where
//
// We call this in a separate block so that it runs after the task appears to have
// completed and will still run if the destructor panics.
let _ = panic::catch_unwind(panic::AssertUnwindSafe(|| {
if let Some(f) = self.trailer().hooks.task_terminate_callback.as_ref() {
if let Some(f) = self.trailer().hooks.task_terminate_callback.as_ref() {
let _ = panic::catch_unwind(panic::AssertUnwindSafe(|| {
f(&TaskMeta {
#[cfg(tokio_unstable)]
id: self.core().task_id,
_phantom: Default::default(),
})
}
}));
}));
}

// The task has completed execution and will no longer be scheduled.
let num_release = self.release();