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

nested block_on's deadlocks #2

Closed
hymm opened this issue Sep 28, 2023 · 2 comments
Closed

nested block_on's deadlocks #2

hymm opened this issue Sep 28, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@hymm
Copy link

hymm commented Sep 28, 2023

I was trying to test smolscale with bevy, and there's some code that needs to bridge sync to async multiple times. Similar to the following:

let mut x = 0;
smolscale::block_on(async move {
    let task = smolscale::spawn(async move {
        smolscale::block_on(async move {
            let task = smolscale::spawn(async move {
                x += 1;
            });
            task.await;
        });
    });
    task.await;
});

but things end up deadlocking. I can also get a deadlock with just nesting the block_on's, but not sure if this is related.

let mut x = 0;
smolscale::block_on(async move {
    smolscale::block_on(async move {
        x += 1;
    });
});
@nullchinchilla
Copy link
Member

I will look into this issue! This is something I've noticed as well.

@nullchinchilla nullchinchilla added the bug Something isn't working label Oct 16, 2023
@nullchinchilla nullchinchilla self-assigned this Oct 16, 2023
@nullchinchilla
Copy link
Member

This is fixed in the latest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants