# New Ticket Created by  mt1957 
# Please include the string:  [perl #128628]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=128628 >


Hi,

With Rakudo version 2016.06-234-g0189851 built on MoarVM version 
2016.06-9-g8fc21d5
implementing Perl 6.c on a Asus laptop running Fedora 23 I see the 
following happen. Running the code below is doing well but when the code 
in the critical section gets complex (e.g. '$r += [+] $i, 3, 4, 5, 6, 7, 
8, 9, 10;'), the program does not finish. The output of the '+' and '-' 
stops but the cpu (2 or 3 of 8) will go to 100% usage (user time, not 
system time).


my Semaphore $s .= new(1);

my @p;
my $r;
for ^4000 {
   my $i = $_;

   @p.push: Promise.start( {

       $s.acquire;
       print "+";

       # critical code area
       $r += $i;

       $s.release;
       print "-";
     }
   );
}


Greetings
Marcel

Reply via email to