v/examples/concurrency/concurrency_returns.v

14 lines
234 B
V

fn expensive_computing(i int) int {
return i * i
}
fn main() {
mut threads := []thread int{}
for i in 1 .. 10 {
threads << go expensive_computing(i)
}
// Join all tasks
r := threads.wait()
println('All jobs finished: $r')
}