Skip to content

Commit

Permalink
don't clone in notify_for_tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
jswrenn committed Oct 6, 2023
1 parent 1a904c8 commit 4264f61
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions tokio/src/runtime/task/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,9 @@ impl<S: 'static> Task<S> {
}

cfg_taskdump! {
pub(super) fn notify_for_tracing(&self) -> Notified<S> {
pub(super) fn notify_for_tracing(self) -> Notified<S> {
self.as_raw().state().transition_to_notified_for_tracing();
Notified(self.clone())
Notified(self)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tokio/src/runtime/task/trace/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ fn trace_owned<S: Schedule>(owned: &OwnedTasks<S>) -> Vec<Trace> {
let mut tasks = vec![];
owned.for_each(|task| {
// notify the task (and thus make it poll-able) and stash it
tasks.push(task.notify_for_tracing());
tasks.push(task.clone().notify_for_tracing());
// we do not poll it here since we hold a lock on `owned` and the task
// may complete and need to remove itself from `owned`.
});
Expand Down

0 comments on commit 4264f61

Please sign in to comment.