Skip to content

Commit

Permalink
Do something with e.g. Channel.list(:wait(.5))
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Mar 15, 2015
1 parent bba8a3a commit 997afa3
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/core/Channel.pm
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ my class Channel {
}
}

method list($self: :$wait = 0 ) {
multi method list(Channel:D $self:) {
gather {
loop {
earliest $self {
Expand All @@ -101,6 +101,17 @@ my class Channel {
}
}
}
multi method list(Channel:D $self: :$wait! ) {
gather {
loop {
earliest $self {
more * { take $_ }
done * { last }
wait $wait { Nil }
}
}
}
}

method close() {
$!closed = 1;
Expand Down

0 comments on commit 997afa3

Please sign in to comment.