rayon-rs / rayon

Rayon: A data parallelism library for Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Function dependencies with Rayon without blocking the thread / Rayon synchronization primitives?

codecnotsupported opened this issue · comments

I've a few OPs that need to be executed in Rayon, but they've dependencies.
There are multiple ways to handle dependencies but decided to put synchronization inside the function.
However using anything blocking (such as a Barrier) with Rayon would prevent work stealing.

I made a quick example to illustrate my solution to my problem.
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=00cb5cf546ec9a3d564d5869fb6c1cd4

I was wondering if Rayon could add some synchronization primitives (like in the example), and if there is anything wrong with the example provided.