Skip to content

rayon::scope in an async context? #1060

@bonsairobo

Description

@bonsairobo

I want to be able to concurrently execute CPU-heavy tasks (on a rayon pool) and wait for IO futures (on a blocking pool) that consume the results of the computational tasks. Because I'm in an async context, ideally I would be able to futures::try_join! those tasks. I've managed to wrap rayon::spawn in a future using async_channel, but this is painful because I can only pass 'static data into rayon::spawn. I'd rather use something like rayon::scope, but this would necessarily block my async executor thread.

I think I need some kind of async fn from rayon that would function like rayon::scope but instead of blocking the thread, it returns a future that completes when the scoped threads complete.

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