Several parallel sequences

If I have 3 sequences that are running in parallel and I need to exit the run once 2 out of the 3 sequences are complete, is fork join_any method the best option?

Is this fork-join_any solution scalable for a big number of parallel sequence runs, or is there any other good approach?

Thanks

In reply to UVM_learner6:

join_any should be scalable as long as you are careful to not leave threads running in the background that you do not specifically need. The best way to control this is through a disable_fork with an isolating thread:


fork begin
   fork 
     //seq_1 call
     //seq_2 call
     //seq_3 call
   join_any
   disable_fork;
end join

As far as needing to wait for 2 out of the 3 sequences to complete, maybe implement some sort of flag system?


int flag = 0;
fork begin
   fork 
     begin
       //seq_1 call
       flag++;
     end
     begin
       //seq_2 call
       flag++;
     end
     begin
       //seq_3 call
       flag++;
     end
   join_any
   fork
     begin
       wait(flag>=2);
     end
     begin
       #10000ps // watchdog timeout
       //PRINT ERROR
     end
   join_any
   disable_fork;
end join