Forever and fork join statement

Hi,
I am having an issue with the piece of scoring code pasted below. The control is not moving to the task inside the fork statement. Is there a corner case which is getting hit bcoz of which the code is not behaving correctly.?

// FIFO to store transaction received on Input monitor 
//----------------------------------------------------
tlm_analysis_fifo #(InputMonitorTxn) input_txn;


task get_input_txn
     forever begin
          InputMonitorTxn txn_copy
          InputMonitorTxn txn

          input_txn.get(txn);
          txn_copy = new(txn);
      fork
          check_input_txn (txn_copy); 
       join_none
       end
       end task

In reply to wasimraza:

Hi,

I believe that there is an issue with the below staement from your code;
input_txn.get(txn);
Try adding some display before and after the above statement and check yourself.
Try check with your port connections and instatiations properly.

Thanks,
Mahesh.

In reply to wasimraza:

Using a fork/join-none in this context is very dangerous. You have the potential to have multiple threads in parallel which may conflict.

If check_input_txn truly needs to be a task (which may not be the case), then you shouldn’t need to fork off the comparison. Since input_txn is a tlm_analysis_fifo, the txn elements will be stored and you can process them as needed.