Disable fork join when one of the tasks complete

In reply to saritr:
This code below using
disable fork
is identical to kddholak’s most recent post above using the
kill()
method

virtual task run_phase (uvm_phase phase);
      forever begin
                fork 
                    monitor_cycle_count();
                    forever begin
                       mon_trx = axi_transaction::type_id::create("mon_trx");
                       fork
                                 begin
                                  monitor_write();
                                  end begin
                                  monitor_read();                 
                                  end 
                       join_any
                       disable fork;
                  end
                join
      end
  endtask: run_phase

The problem with either of these, is that the inner
forever
loop is persistent. It never terminates, so the
fork/join
never joins, so the outer
forever
loop never repeats.