Experts,
This example is direct from the LRM. ‘do_n_way’ is a automatic task. Why is ‘k’ still automatic? I thought variables inside automatic task are by default automatic
task automatic do_n_way(int N);
process job[] = new [N];
foreach (job[j])
fork
automatic int k = j;
begin
job[k] = process::self();
... ;
end
join_none
foreach (job[j]) // wait for all processes to start
wait(job[j] != null);
job[0].await(); // wait for first process to finish
foreach (job[j]) begin
if (job[j].status != process::FINISHED)
job[j].kill();
end
endtask
Appreciate you time.