Skip to content

Nested task_spawn with block_on is not working #760

Closed
@manikawnth

Description

@manikawnth

Nested block_on works:

task::block_on(async {
    task::block_on(fib_async(45));
});

Nested task_spawn with await works:

let s = task::spawn( async {
    task::spawn(fib_async(45)).await;
});
    
task::block_on(s);

but nested task_spawn with block_on doesn't work:

let s = task::spawn( async {
    let s1 = task::spawn(fib_async(45));
    task::block_on(s1);
});
    
task::block_on(s);

Version:
async-std = "1.5.0"

Not sure if I'm doing something obviously wrong!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions