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

tokio::task::block_in_place can only be called inside spawned tasks #19

Open
Marwes opened this issue Jan 7, 2020 · 1 comment
Open

Comments

@Marwes
Copy link

Marwes commented Jan 7, 2020

The following panics

#[test]
fn block_on_from_block_on() {
    let mut rt = runtime::Runtime::new().unwrap();
    rt.block_on_std(async {
        tokio_02::task::block_in_place(move || ());
    });
}

Easy workaround by wrapping the bblock_in_place call with a tokio::spawn, but it had me confused for a bit.

@hawkw
Copy link
Member

hawkw commented Jan 7, 2020

Yeah, this is a Tokio 0.2 limitation — there is an upstream ticket about it: tokio-rs/tokio#1838. As per tokio-rs/tokio#1838 (comment), this limitation may be removed in the future.

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

No branches or pull requests

2 participants