Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
18 lines (17 sloc) 435 Bytes
use Threads;
my ($read, $write) = objectpipe;
my $t = Threads::Thread.new({
my $last = 0;
for 1..200 -> $i { $write.put($i~'-'~time); $last = $i; };
CATCH { default { say "pipe closed... sent $last items" } }
});
$read.thread = $t;
{
for 1..5 {
say $read.get() for 1..20;
sleep 1
}
$read.DESTROY();
$read = Nil;
}
say "compare the number of the last consumed item, with the last sent item."
Something went wrong with that request. Please try again.