Disable with label is not working for while loop

HI All,

I am trying to kill all threads of specific fork join by using disable with label .
But,disable with label is not working for while loop.


class abc;
  int a;
  
  task run_phase();
    fork :main
      begin : wait_10t
        $display("t=%0t , WAIT START",$realtime());
        #10ns;
        $display("t=%0t , WAIT END",$realtime());
      end 
      begin : count_20t
        while(a < 20) begin 
          $display("t=%0t , a=%0d",$realtime(),a);
          a++;
          #1ns;
 
        end 
      end 
    join_any
    disable main;
    $display("TEST ENDED");
  endtask 
endclass

module tst;
  abc a;
  initial begin 
    a = new();
    a.run_phase();
  end 
endmodule 


Output :
t=0 , WAIT START
t=0 , a=0
t=1 , a=1
t=2 , a=2
t=3 , a=3
t=4 , a=4
t=5 , a=5
t=6 , a=6
t=7 , a=7
t=8 , a=8
t=9 , a=9
t=10 , WAIT END
TEST ENDED
t=10 , a=10
t=11 , a=11
t=12 , a=12
t=13 , a=13
t=14 , a=14
t=15 , a=15
t=16 , a=16
t=17 , a=17
t=18 , a=18
t=19 , a=19

Here,Disable fork is working fine but Its killing other test process hence I have used disable with label instead of disable fork .
Could anyone tell me that Its a valid way to disable with label or not to kill all the threads ?
Could you give other alternative logic to kill while loop ?

Thanks,
Prashant

In reply to Prashant Soni:

Hi Prashant,

Your case is exactly this thread :

Please note the last comment in the thread, which is very much true here as well. Your code works as expected in 3/4 simulators in EDA playground.

Your code works as I would expect on 3 out of 4 simulators on www.edaplayground.com. They all interpret the statement “The disable statement shall terminate the activity of a task or a named block” in section 9.6.2 Disable statement to include the processes spawned by a fork statement.
This Mentor/Siemens EDA sponsored public forum is not for discussing tool specific usage or issues. Please contact your tool vendor directly for support.

In reply to Prashant Soni:

Here,Disable fork is working fine but Its killing other test process hence I have used disable with label instead of disable fork .
Could anyone tell me that Its a valid way to disable with label or not to kill all the threads ?
Could you give other alternative logic to kill while loop ?

You can try this: Edit code - EDA Playground