Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Hopefully fix hanging issues, TimToady++
  • Loading branch information
lizmat committed Dec 25, 2015
1 parent 57179ad commit c5e65d7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions S17-supply/throttle.t
Expand Up @@ -49,15 +49,15 @@ diag "**** scheduling with {$*SCHEDULER.WHAT.perl}";
}

for 1..10 -> $n {
my @a; @a[9] = 0; # pre-size array to allow seamless multi-thread updates
(1..10).Supply.throttle( $n, { @a[$_] = 1 } ).wait;
my @a[10]; # pre-size array to allow seamless multi-thread updates
(^10).Supply.throttle( $n, { @a[$_] = 1 } ).wait;
is @a.sum, 10, "ok with $n at a time";
}

for 1..10 -> $n {
my @a; @a[9] = 0; # pre-size array to allow seamless multi-thread updates
my @a[10]; # pre-size array to allow seamless multi-thread updates
my $before = now;
(1..10).Supply.throttle( $n, { sleep rand; @a[$_] = 1 } ).wait;
(^10).Supply.throttle( $n, { sleep rand; @a[$_] = 1 } ).wait;
ok now < $before + ((12 - $n) * .6), "parallelism as expected with $n";
is @a.sum, 10, "ok with $n at a time with random delay";
}
Expand Down

0 comments on commit c5e65d7

Please sign in to comment.