proc slow(label: Str, ms: Int): Str {
hive.task.sleep(ms)
return label
}
proc main(): void {
a := async slow("a", 30) // starts now
b := async slow("b", 30) // starts now, alongside
echo "{a} and {b}" // waits for both, right here
}proc slow(label: Str, ms: Int): Str {
hive.task.sleep(ms)
return label
}
proc main(): void {
if slow("c", 300) with timeout 50 is Result.Error(err) {
echo "gave up after {err.waited}ms"
}
}