Question about argument passing behavior in fork join_none block

In reply to peterjin:

Because you declared the task receive() with a static lifetime (the implicit default lifetime). That means there is only one argument index for all calls to receive. Change the declaration to

task automatic receive(int index);