3 ms·
But that arguably doesn’t use this feature to its fullest — the most naive/easy to comprehend way to do concurrency is to start up multiple threads calculating
by kaba0 4y ago
But that arguably doesn’t use this feature to its fullest — the most naive/easy to comprehend way to do concurrency is to start up multiple threads calculating something and simply wait for all of them to return, and at this point you are free to use the calculated results as is. This is the most-idiomatic way to make java virtual threads (with a try-with-resources block)
- Rapzid 4y agoI'm not sure I understand. The waiting for them all to return; isn't that Callable<T>? Goroutines can wrap code you don't want to block callers, but in practice that get hidden behind APIs that return channels.