4 ms·
This sounds like what scoped threads at least partially provides. It was in pre-1.0 Rust, got moved to a 3rd party library, but stabilized in 1.63: https://doc.
by bluejekyll 3y ago
This sounds like what scoped threads at least partially provides. It was in pre-1.0 Rust, got moved to a 3rd party library, but stabilized in 1.63: https://doc.rust-lang.org/stable/std/thread/fn.scope.html https://doc.rust-lang.org/stable/std/thread/fn.scope.html
- thesuperbigfrog 3y agoSome of the features are there, but not all: It looks like each thread in scoped threads must be "manually started" (not launched automatically at the beginning of the scope). No defined mechanisms for synchronization or data passing between scoped threads. There are probably ways it can be done, but I am not sure what approach would work best without some experimentation.
- wongarsu 3y agoIn Rust, the idiomatic solutions for data-passing would be a fifo channel (either std::sync::mpsc from the standard library or one of the popular libraries (crossbeam or flume)), and the solution for synchronization would be one-shot channels or zero-capacity channels. Or you can just manually join the threads you started