Skip to content

Instantly share code, notes, and snippets.

@autarch
Created December 6, 2015 22:17
Show Gist options
  • Select an option

  • Save autarch/2ea935d60aeddc23dc4e to your computer and use it in GitHub Desktop.

Select an option

Save autarch/2ea935d60aeddc23dc4e to your computer and use it in GitHub Desktop.
method !run-with-progress ($items, Routine $sub, Str $msg = q{ done}) {
my $prog = Term::ProgressBar.new( :count( $items.elems ), :p )
if $!verbose;
my $i = 1;
my $supply = $items.Supply.throttle(
$!threads,
-> $item {
say "$i = $item in {$*THREAD.id}";
# $sub($item);
# $prog.?update($i);
$i++;
}
);
$supply.wait;
$prog.?message($msg);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment