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

runtime: Add threaded_scheduler to examples #2277

Merged
merged 1 commit into from
Feb 27, 2020

Conversation

Darksonn
Copy link
Contributor

It can be pretty confusing when the core_threads example does not call threaded_scheduler, since actually building such a runtime results in panics if you try to spawn something on it:

async fn a() {}

fn main() {
    let mut rt = runtime::Builder::new()
        .core_threads(4)
        .build()
        .unwrap();
        
    rt.spawn(a()); // panic
    rt.block_on(a());
}

playground

It can be pretty confusing when the core_threads example does not call
threaded_scheduler, when actually building such a runtime results in
panics if you try to spawn something on it:

https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=866b3af344b0d6aad170ac9cbc9d57ed
@Darksonn Darksonn added the T-docs Topic: documentation label Feb 26, 2020
@Darksonn Darksonn requested a review from carllerche February 26, 2020 19:58
@Darksonn Darksonn self-assigned this Feb 26, 2020
Copy link
Member

@carllerche carllerche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! thanks!

@carllerche carllerche merged commit f0d1865 into tokio-rs:master Feb 27, 2020
@Darksonn Darksonn deleted the runtime-doc branch February 27, 2020 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-docs Topic: documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants