Kill a process inside fork

Hey all,
I have a fork block when i run 2 process concurrently ( process_a & process_b ). I want to kill (disable) process_a from inside process_b if some condition is met. Could you point me to the command i’m looking for.
Thank u all in advance.

In reply to abdelaali_21:

fork
begin : PROCESS_1
// do something
end

begin : PROCESS_2 

// do something 
 disable PROCESS_1 

end 

join

In reply to MP:

Although the disable statement works in many cases, it does not work if the fork is inside a class method and there are multiple instances of the method invoking the fork. The preferred approach is using the built-in
process
class. (See section 9.7 Fine-grain process control in the IEEE 1800-2017 SystemVerilog LRM)

fork 
  process p;
  begin : process_a
    p = process::self(); 
    // do something 
  end 
  begin : process_b
    // do something 
    if (some_condition)
      p.kill();
  end 
join

A warning whether you kill or disable a process: all its descendent processes are killed too, but non-descendent processes that interact with the ones you just killed may need special handling. This issue comes up in producer/consumer threads like the UVM sequence/driver protocol where you kill the producer and may need to reset the consumer.

In reply to dave_59:

Hey all,
I have 2 agents, one for reset and the other for some bus protocol, when i run reset sequence on reset sequencer it goes through the code of driver of the bus protcol too, where i did some condition for bus protocol behaviour when reset is applied. consequently my test broke.
Any help would be appreciated

In reply to abdelaali_21:

We have no idea what “goes through the code of driver” means.

You might want to read On the Fly Reset | Verification Horizons | Verification Academy