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

release GIL for detached smol::Executor #4776

Open
ertosns opened this issue Dec 6, 2024 Discussed in #4775 · 0 comments
Open

release GIL for detached smol::Executor #4776

ertosns opened this issue Dec 6, 2024 Discussed in #4775 · 0 comments

Comments

@ertosns
Copy link

ertosns commented Dec 6, 2024

Discussed in #4775

Originally posted by ertosns December 6, 2024
allow_threads doesn't release gil for detached smol::Executor in background, for example the following code block only run in the main thread, and the gil doesn't seem to be released.

async fn executor_run() {
    let ex = Arc::new(smol::Executor::new());
    let fut = ex.spawn(async {
        println!("executor run\n");
    });
    Python::with_gil(|gil| {
            gil.allow_threads(|| {
                fut.detach();
            })
    })
}
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

1 participant