Disable fork is not working inside fork join

In reply to marathuteja:
This worked for me


module top;
  event a, b, c;
  initial
    begin      
    $dumpfile("dump.vcd"); $dumpvars;
      fork: my_fork
        begin
          #10 $display("%t 1st process", $time);
          -> a;
        end
        begin
          #20 $display("%t 2nd process", $time);
          ->b;
        end
        begin
          #30 $display("%t 3rd process", $time);
          ->c;
        end
        begin
          static int  count='0;
          forever
            begin
              @(a or b or c)
              count++;
              $display("%d", count);
              if(count == 32'd2)
                begin
                  $display("disable fork");
                  disable  my_fork;
                end
            end
        end
      join
          $display("Completed");
    end
endmodule
/*run -all
#                   10 1st process
#           1
#                   20 2nd process
#           2
# disable fork
# Completed
# exit
*/

Ben Cohen
Ben@systemverilog.us
Link to the list of papers and books that I wrote, many are now donated.

or Cohen_Links_to_papers_books - Google Docs

Getting started with verification with SystemVerilog