How to convert fork join to fork_join_any

could you please let me know

how to convert fork join to fork join_any

In reply to srbeeram:

Consider following fork … join_any code ::


 
 initial   begin

     fork  
       
      begin:T1
         $display("In T1");
         #5 ;
         $display("Done with T1");
      end

      begin:T2
        $display("In T2");
         #7 ;
        $display("Done with T1");  
      end

     join_any 

        $display("In  Parent thread ");

   end


To achieve this via fork join ::



initial   begin
 int counter ;
     fork  
       
      begin:T1
         $display("In T1");
         #5 ;
         $display("Done with T1");
         counter++;
      end

      begin:T2
        $display("In T2");
         #7 ;
        $display("Done with T1");  
         counter++;
      end

      begin
        wait ( count >= 1 ) ;
       $display("In  Parent thread ");

      end

     join

        

   end



In reply to ABD_91:

That is conversion in the wrong direction.

In reply to srbeeram:

Your question needs a lot more detail. If this is just a bad interview question and they are looking for equivalencies, then you can say fork/join is equivalent to fork/join_any followed by wait fork;

In reply to dave_59:

Thanks dave for the clarifications.