-
Notifications
You must be signed in to change notification settings - Fork 559
Description
The documentation for spawn_future_async says that the future it's passed is run in rayon's thread pool, and the returned future polls for the result. I had assumed that means that the intended use is to do number crunching/blocking operations inside the passed future, and polling the returned RayonFuture (e.g. in a tokio reactor) wouldn't block.
This is inconsistent with experimentation. Distilled example: https://github.com/aweinstock314/power/blob/master/examples/rayon_test.rs, full context of what I was trying to do: https://github.com/aweinstock314/power/blob/354921a2b37d5c28d9ec02e26746d1f9e6e4632a/src/main.rs#L200-L234
The workaround of combining rayon::spawn_async and futures::sync::oneshot::channel has the semantics that I hoped to get from spawn_future_async. I'm not sure if this is a documentation bug or an implementation bug.