> On 28 Jul 2015, at 13:48, Justin DeVuyst (via RT) > <perl6-bugs-follo...@perl.org> wrote: > > # New Ticket Created by Justin DeVuyst > # Please include the string: [perl #125705] > # in the subject line of all future correspondence about this issue. > # <URL: https://rt.perl.org/Ticket/Display.html?id=125705 > > > > Hello, > > The code below, when it decides to manifest (~ 1 in 10 for me at the > moment), > produces something like: > > *** Error in `/home/jdv/rakudo/install/bin/moar': double free or > corruption (!prev): 0x00007ff7f4009c30 *** > *** Error in `/home/jdv/rakudo/install/bin/moar': double free or > corruption (!prev): 0x00007ff7f4009c30 *** > *** Error in `/home/jdv/rakudo/install/bin/moar': double free or > corruption (!prev): 0x00007ff7f4009c30 *** > ... > Aborted (core dumped) > > or > > Segmentation fault (core dumped) > > or other similar looking outputs. > > And here's the code: > > use v6; > > for 1..15 { > > my $lock = Lock.new; > my $cond = $lock.condition; > my $todo = 0; > my $done = 0; > my @in = 1..100; > my @out; > > loop ( my $i = 0; $i < @in; $i++ ) { > my $in := @in[$i]; > my $out := @out[$i]; > $lock.protect( { > $*SCHEDULER.cue( { > $out = $in * 10; > $lock.protect( { > $done++; > $cond.signal if $done == $todo; > } ); > } );
Is it wise (or even sane) to use the same lock inside protected code with that lock??? > $todo++; > } ); > } > > $lock.protect( { $cond.wait unless $done == $todo; } ); > > say @out; > > } > > And here's what I'm running: > > [jdv@wieldy ~]$ perl6 -v > This is perl6 version 2015.07.1-3-g6bbb56f built on MoarVM version > 2015.07 > [jdv@wieldy ~]$ > > -jdv