In Channel§
See primary documentation in context for sub await
multi await(Channel:D) multi await(*@)
Waits until all of one or more Channel
s has a value available, and returns those values (it calls .receive
on the Channel
). Also works with Promise
s.
my $c = Channel.new; Promise.in(1).then({$c.send(1)}); say await $c;
Since 6.d, it no longer blocks a thread while waiting.
In Promise§
See primary documentation in context for sub await
multi await(Promise:D --> Promise) multi await(*@ --> Array)
Waits until one or more promises are all fulfilled, and then returns their values. Also works on Channel
s. Any broken promises will rethrow their exceptions. If a list is passed it will return a list containing the results of awaiting each item in turn.