In reply to vk7715:
Try the following code: , I added an automatic int i, since in your code due to fork and for combination , for looped through to last iteration.
module fork_join;
event a;
task A(input int i);
$display("Task A. Time = %0t, i = %0d", $time, i);
endtask
task B(i);
$display("Task B. Time = %0t, i = %0d", $time, i);
endtask
initial begin
for(int j = 0; j < 10; j++) begin
automatic int i=j;
fork
A(i);
join_none
end
->a;
@(a);
B(2);
end
endmodule