Skip to content

Commit 976fa40

Browse files
committed
Merge pull request #398 from dbrunton/patch-10
Wait for it...
2 parents f693ca4 + dacf38f commit 976fa40

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

doc/Type/Supply.pod

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -148,18 +148,16 @@ the GUI thread.
148148
Waits until the supply is done (in which case it returns C<True>) or C<quit>
149149
(in which case it will throw the exception that was passed to C<quit>).
150150
151-
my $s = Supply.new;
152-
$s.tap(&say);
153-
my $p = Promise.allof((^10).pick(*).map: -> $v {
154-
start {
155-
$s.emit($v)
156-
}
157-
});
158-
$p.then({ $s.done });
159-
160-
$s.wait;
161-
say "Done";
162-
await $p;
151+
my $s = Supplier.new;
152+
start {
153+
sleep 1;
154+
say "One second: running.";
155+
sleep 1;
156+
$s.emit(42);
157+
$s.done;
158+
}
159+
$s.Supply.wait;
160+
say "Two seconds: done";
163161
164162
=head2 method list
165163

0 commit comments

Comments
 (0)