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

Scheduler cleanup #5909

Closed
wants to merge 15 commits into from
Closed

Scheduler cleanup #5909

wants to merge 15 commits into from

Conversation

brson
Copy link
Contributor

@brson brson commented Apr 16, 2013

This is just a bunch of minor changes and simplifications to the structure of core::rt. It makes ownership of the ~Scheduler more strict (though it is still mutably aliased sometimes), turns the scheduler cleanup_jobs vector into just a single job, shunts the thread-local scheduler code off to its own file.

brson added 15 commits April 14, 2013 16:05
We need a number of mutable references to contexts so name it
`get_contexts` and return a tuple of all of them.
Each context switch has up to one cleanup job and it is always
executed immediately after the context switch.
Remove the ThreadLocalScheduler type in favor of functions.
Move everything into the sched::local module.
…nter

Instead of taking a closure. It's unsafe either way. Rename it to unsafe_local_borrow.
…uler

In order to do a context switch you have to give up ownership of the scheduler,
effectively passing it to the next execution context. This could help avoid
some situations here tasks retain unsafe pointers to schedulers between context
switches, across which they may have changed threads.

There are still a number of uses of unsafe scheduler pointers.
Only when borrowing the I/O implementation do we need unsafety
Conflicts:
	src/libcore/rt/sched/mod.rs
@brson brson mentioned this pull request Apr 17, 2013
bors added a commit that referenced this pull request Apr 18, 2013
This is just a bunch of minor changes and simplifications to the structure of core::rt. It makes ownership of the ~Scheduler more strict (though it is still mutably aliased sometimes), turns the scheduler cleanup_jobs vector into just a single job, shunts the thread-local scheduler code off to its own file.
@bors bors closed this Apr 18, 2013
bors added a commit that referenced this pull request Apr 18, 2013
This builds on #5909. I've been combing through the pipes code to understand it and started refactoring a bit.

* Removes pipes::spawn_* functions. These are not particularly useful since they deal with low-level pipes types.
* Inlines the protocol-compiled definitions of `oneshot` and `streamp`. These are the only two uses of the protocol compiler in core and I'm inlining them so I can understand what they are doing as I work on pipes. I may un-inline them in the future.
* Removes redundant functions from core::comm
* Change the constructors to use the `new` convention
flip1995 pushed a commit to flip1995/rust that referenced this pull request Sep 10, 2020
Add a lint for an async block/closure that yields a type that is itself awaitable.

This catches bugs of the form

tokio::spawn(async move {
    let f = some_async_thing();
    f // Oh no I forgot to await f so that work will never complete.
});

See the two XXXkhuey comments and the unfixed `_l` structure for things that need more thought.

*Please keep the line below*
changelog: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants