Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Cleanup example code

  • Loading branch information...
commit f8a417fe95c047403a0fc3b4f56e5de511350965 1 parent 8063472
Tadeusz Sośnierz authored
Showing with 1 addition and 3 deletions.
  1. +1 −3 examples/producer-consumer.pl
4 examples/producer-consumer.pl
View
@@ -4,7 +4,7 @@
my @elements;
my $free-slots = Semaphore.new(value => 10); # 10 remaining slots
-my $full-slots = Semaphore.new(value => 0); # 10 remaining slots
+my $full-slots = Semaphore.new(value => 0); # 10 slots taken
sub produce($id) {
my $i = 0;
@@ -16,7 +16,6 @@ ($id)
$i++;
note "Now present {+@elements} elements";
$full-slots.post; # there is now one more full slot
- 1;
}
}
@@ -27,7 +26,6 @@ ($id)
my $a = @elements.shift;
note "Consumer $id eating $a";
$free-slots.post; # there is now one more free slot
- 1;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.