Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Wait for it...
Supply.wait blocks until Supplier is done.
  • Loading branch information
dbrunton committed Feb 16, 2016
1 parent f693ca4 commit dacf38f
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions doc/Type/Supply.pod
Expand Up @@ -148,18 +148,16 @@ the GUI thread.
Waits until the supply is done (in which case it returns C<True>) or C<quit>
(in which case it will throw the exception that was passed to C<quit>).
my $s = Supply.new;
$s.tap(&say);
my $p = Promise.allof((^10).pick(*).map: -> $v {
start {
$s.emit($v)
}
});
$p.then({ $s.done });
$s.wait;
say "Done";
await $p;
my $s = Supplier.new;
start {
sleep 1;
say "One second: running.";
sleep 1;
$s.emit(42);
$s.done;
}
$s.Supply.wait;
say "Two seconds: done";
=head2 method list
Expand Down

0 comments on commit dacf38f

Please sign in to comment.