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: store driver handles next to scheduler handle #5008

Merged
merged 1 commit into from Sep 13, 2022

Conversation

carllerche
Copy link
Member

In an earlier PR (#4629), driver handles were moved into the scheduler handle (Spawner). This was done to let the multi-threaded scheduler have direct access to the thread pool spawner.

However, we are now working on a greater decoupling of the runtime internals. All drivers and schedulers will be peers, stored in a single thread-local variable, and the scheduler will be passed the full runtime::Handle. This will achieve the original goal of giving the scheduler access to the thread-pool while also (hopefully) simplifying other aspects of the code.

In an earlier PR (#4629), driver handles were moved into the scheduler
handle (`Spawner`). This was done to let the multi-threaded scheduler
have direct access to the thread pool spawner.

However, we are now working on a greater decoupling of the runtime
internals. All drivers and schedulers will be peers, stored in a single
thread-local variable, and the scheduler will be passed the full
runtime::Handle. This will achieve the original goal of giving the
scheduler access to the thread-pool while also (hopefully) simplifying
other aspects of the code.
@github-actions github-actions bot added the R-loom Run loom tests on this PR label Sep 13, 2022
@carllerche carllerche added C-maintenance Category: PRs that clean code up or issues documenting cleanup. A-tokio Area: The main tokio crate M-runtime Module: tokio/runtime and removed R-loom Run loom tests on this PR labels Sep 13, 2022
@carllerche
Copy link
Member Author

When I tried to tease out the time Arcs from the time driver, I discovered that I needed runtime::Handle to be defined without the rt feature flag enabled. However, getting this to work with the current struct layout is non trivial since Spawner is an rt concern. By moving the driver handles to the top level of Handle, a follow-up PR will be able to define Handle without rt (though the type will be private).

@carllerche carllerche merged commit 56ffea0 into master Sep 13, 2022
@carllerche carllerche deleted the flatten-rt-handle branch September 13, 2022 19:40
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 C-maintenance Category: PRs that clean code up or issues documenting cleanup. M-runtime Module: tokio/runtime
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants