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

Task poll callbacks #7120

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Conversation

GJason88
Copy link

Iteration on #7107

Discussion was had on discord.

  • Added implementation to current_thread runtime (factored out callback logic to TaskHooks).
  • Moved multi_thread poll_start_callback call to be directly before task.run().
  • Added docs and examples to public methods.
  • Added #[cfg(tokio_unstable)] to the rest of the implementation.
  • Updates to tests: Added a test for current_thread, and assertions for task_id. Talked about potentially adding test for any edge cases regarding LIFO.

Looking to bikeshed on naming.

Motivation

We would like to be able to store metadata before polls start and stop to allow us to instrument all polls, not just polls where you have spawned the task.

Solution

Add callbacks for poll start and stop

@github-actions github-actions bot added R-loom-current-thread Run loom current-thread tests on this PR R-loom-multi-thread Run loom multi-thread tests on this PR R-loom-multi-thread-alt Run loom multi-thread alt tests on this PR labels Jan 22, 2025
@GJason88 GJason88 marked this pull request as draft January 22, 2025 22:17
@GJason88 GJason88 force-pushed the task-poll-callbacks branch 2 times, most recently from 3491a25 to f1a7c83 Compare January 23, 2025 14:34
@maminrayej maminrayej added A-tokio Area: The main tokio crate M-runtime Module: tokio/runtime M-task Module: tokio/task and removed M-task Module: tokio/task labels Jan 23, 2025
@GJason88 GJason88 force-pushed the task-poll-callbacks branch from f1a7c83 to 404d496 Compare January 23, 2025 17:56
@GJason88 GJason88 force-pushed the task-poll-callbacks branch from 404d496 to d761c88 Compare January 23, 2025 18:46
@GJason88 GJason88 marked this pull request as ready for review January 24, 2025 14:53
@Darksonn Darksonn requested a review from Noah-Kennedy January 27, 2025 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate M-runtime Module: tokio/runtime R-loom-current-thread Run loom current-thread tests on this PR R-loom-multi-thread Run loom multi-thread tests on this PR R-loom-multi-thread-alt Run loom multi-thread alt tests on this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants