Disable fork join when one of the tasks complete

In reply to dave_59:

Thanks Dave . I have updated the solution.


virtual task run_phase (uvm_phase phase);
     process thread[$] ;
      forever begin
                fork 
                    monitor_cycle_count();
                    forever begin
                       mon_trx = axi_transaction::type_id::create("mon_trx");
                       fork
                                 begin
                                  thread.push_back(process::self());
                                  monitor_write();
                                  end begin
                                  thread.push_back(process::self());
                                  monitor_read();                 
                                  end 
                       join_any
                       foreach(thread[i]) thread[i].kill();
                       thread = {}; // delete the Q
                  end
                join
      end
  endtask: run_phase