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


On Rakudo Star 2014.08:

$ perl6 -e 'my $job1 = start { say "started job 1"; sleep 4; say "finished job 
1"}; my $job2 = start { say "started job 2"; sleep 4; say "finished job 2"}; 
await $job1, $job2'

In most cases I get expected result:

started job 1
started job 2
... 4 seconds wait time
finished job 2
finished job 1

But sometimes promises are executed synchronously:

started job 1
... 4 seconds wait time
finished job 1
started job 2
... 4 seconds wait time
finished job 2


Looks like they are assigned to the same thread despite other threads being 
unused.

My common-sense assumption was "If I spawn less Promises than available threads 
they will be ALL executed in parallel".
But this behavior randomly ruins script performance.

Reply via email to