How to disable single thread that's spawned off of a for loop

Hi,

I’m looking for a way to disable a thread for a particular index. How would I be able to do that. Using a label infront of fork and disable on it will disable all threads spawned for all indexes. Please advise if there a solution to do this.

Here is a sample code I’m trying to achieve.

task A();
   for (int i=0; i<n; i++)
   fork
     automatic int idx =i;
     drive_req(i);
   join_none
endtask

task drive_req(int idx)

forever begin
 @(posedge clk);
 if(a) begin
   ...x....
   disable <idx>
   .......
 end // end iff=
 else if (b) begin
   ----y--
  <idx> : fork 
   ---
   ---
  join_none
 end // end else 
end

endtask

Thanks

In reply to vdev:

See Section 9.7 Fine-grain process control in the 1800-2017 LRM.

In reply to dave_59:

Thanks for pointer Dave. I will use jobs[k].kill() and get back to you if that doesn’t work.