Sequences started in parallel and how to use fork join_any if the number of sequences is varied?

In reply to dv_lee86:

You can put this in a fork join_none loop and trigger an event when one of the sequences finishes.

task test1(int n);
event done;
...
  fork // isolation for disable fork if needed 
    begin :isolation_thread
      for (int int i=1;i<=n;i++)
        fork
          int j = i;
          begin
            seq[j].start(null);
            ->done;
          end
        join_none
      @done
      disable fork;
    end : isolation_thread
  join
..
endtask;