await
ErrorsCollection

await

Synthesised documentation from type/Promise type/Channel

From type/Promise

See Original text in context

multi sub await(Promise:D --> Promise)
multi sub await(*@ --> Array)

Waits until one or more promises are all fulfilled, and then returns their values. Also works on channels. 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.

From type/Channel

See Original text in context

multi sub await(Channel:D)
multi sub await(*@)

Waits until all of one or more channels has a value available, and returns those values (it calls .receive on the channel). Also works with promises.

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.