Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make EARLIEST somewhat more functional
@a.push: [1,2,3] is flattening the values, fixed by manually itemizing.
Which brings us to the next bug, with @todo.pick(*) apparently not being
allowed to run more than once.  Weird.
  • Loading branch information
lizmat committed Aug 16, 2015
1 parent 18e485a commit 360ac8e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/core/asyncops.pm
Expand Up @@ -73,7 +73,8 @@ sub EARLIEST(@earliest,*@other,:$wild_done,:$wild_more,:$wait,:$wait_time) {

for @contestant {
%channels-by-kind{$kind}{$_.WHICH} = $_;
@todo.push: [ +@todo, $kind, $_, &block ];
# XXX GLR .item necessary ??
@todo.push: [ +@todo, $kind, $_, &block ].item;
}
}

Expand All @@ -88,13 +89,15 @@ sub EARLIEST(@earliest,*@other,:$wild_done,:$wild_more,:$wait,:$wait_time) {

if $wild_more.defined {
if not %channels-by-kind{$EARLIEST_KIND_MORE}{$n}:exists {
@todo.push: [ +@todo, $EARLIEST_KIND_MORE, $_, $wild_more ];
# XXX GLR .item necessary ??
@todo.push: [ +@todo, $EARLIEST_KIND_MORE, $_, $wild_more ].item;
%distinct-channels{$n} = $_;
}
}
if $wild_done.defined {
if not %channels-by-kind{$EARLIEST_KIND_DONE}{$n}:exists {
@todo.push: [ +@todo, $EARLIEST_KIND_DONE, $_, $wild_done ];
# XXX GLR .item necessary ??
@todo.push: [ +@todo, $EARLIEST_KIND_DONE, $_, $wild_done ].item;
%distinct-channels{$n} = $_;
}
}
Expand All @@ -112,7 +115,7 @@ sub EARLIEST(@earliest,*@other,:$wild_done,:$wild_more,:$wait,:$wait_time) {

CHECK:
loop { # until something to return
for @todo.pick(*,:eager) -> $todo {
for @todo.pick(*) -> $todo {
my $kind := $todo[1];
my $contestant := $todo[2];

Expand Down

0 comments on commit 360ac8e

Please sign in to comment.