Skip to content

Instantly share code, notes, and snippets.

@ugexe
Created August 5, 2015 18:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ugexe/ab6ca0453900cc0c746d to your computer and use it in GitHub Desktop.
Save ugexe/ab6ca0453900cc0c746d to your computer and use it in GitHub Desktop.
method start-processes {
my $p = Promise.new;
$p.keep(1);
for @!processes -> $level {
my @not-started := $level.list.grep({ !$_.started });
$p = $p.then: {
my @promises := @not-started.map: { $_.start }
await Promise.allof(@promises) if @promises;
}
}
$p;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment