sub await
1 | class Promise |
1.1 | (Promise) sub await |
2 | class Channel |
2.1 | (Channel) sub await |
Documentation for sub await
assembled from the following types:
class Promise
From Promise
(Promise) sub await
multi sub await(Promise --> 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.
class Channel
From Channel
(Channel) sub await
Defined as:
multi sub await(Channel)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 = Channel.new;Promise.in(1).then();say await ;
Since 6.d, it no longer blocks a thread while waiting.