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: use optional non-zero value for task owner_id #5876

Merged
merged 5 commits into from
Jul 18, 2023

Conversation

hds
Copy link
Contributor

@hds hds commented Jul 17, 2023

We switch to using a NonZeroU64 for the id field for OwnedTasks
and LocalOwnedTasks lists. This allows the task header to contain an
Option<NonZeroU64> instead of a u64 with a special meaning for 0.

The size in memory will be the same thanks to Rust's niche optimization,
but this solution is clearer in its intent.

We switch to using a `NonZeroU64` for the `id` field for `OwnedTasks`
and `LocalOwnedTasks` lists. This allows the task header to contain an
`Option<NonZeroU64>` instead of a `u64` with a special meaning for 0.

The size in memory will be the same thanks to Rust's niche optimization,
but this solution is clearer in its intent.
@github-actions github-actions bot added the R-loom Run loom tests on this PR label Jul 17, 2023
tokio/src/runtime/task/list.rs Outdated Show resolved Hide resolved
tokio/src/runtime/task/list.rs Outdated Show resolved Hide resolved
tokio/src/runtime/task/core.rs Outdated Show resolved Hide resolved
tokio/src/runtime/task/core.rs Outdated Show resolved Hide resolved
@Darksonn Darksonn added A-tokio Area: The main tokio crate M-runtime Module: tokio/runtime labels Jul 17, 2023
hds and others added 4 commits July 17, 2023 15:29
- add comments when exiting early from (Local)OwnedTasks::remove
- set_owner_id no longer takes an Option
- comment corrections
@hds hds mentioned this pull request Jul 17, 2023
@hds hds merged commit f24b982 into master Jul 18, 2023
@hds hds deleted the hds/owned-tasks-id-nonzero branch July 18, 2023 07:43
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 Run loom tests on this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants