Hacker News new | ask | show | jobs
by babyloneleven 2528 days ago
The rayon crate has a global state: the entire program must use the same thread pool, even if different crates depend on different rayon versions.

It uses a Cargo feature meant to be used by native libraries: you typically can link them only once (or else the build will fail when it finds repeated symbols), so Cargo must ensure only one is present on the entire dependency graph. And IIRC Rayon depends on an auxiliary crate that fakes a native lib and provides the thread pool.

If this seems very hacky and convoluted, it's because it is.