How a event variable is assigned to another event variable?

Hi,
I am wondering why ev_b is not triggered in such two situations:

module tb;
  event ev_a, ev_b;
  
  initial begin 
    fork 
      begin
        wait(ev_a.triggered);
        $display("[%0t]Thread1: ev_a get triggered",$time);
      end 
      
      begin 
        wait(ev_b.triggered);
        $display("[%0t]Thread2: ev_b get triggered", $time);
      end 
      begin 
      #40;
      ->ev_a;
      end 
      
      begin
      #30 ;
        ->ev_b;
      end 
      
      begin
        #10 ev_b = ev_a;
      end 
    join  
  end 
endmodule 

[reporting result]
[30]Thread1: ev_a get triggered


module tb;
  event ev_a, ev_b;
  
  initial begin 
    fork 
      begin
        wait(ev_a.triggered);
        $display("[%0t]Thread1: ev_a get triggered",$time);
      end 
      
      begin 
        wait(ev_b.triggered);
        $display("[%0t]Thread2: ev_b get triggered", $time);
      end 
      begin 
      #20;
      ->ev_a;
      end 
      
      begin
      #30 ;
        ->ev_b;
      end 
      
      begin
        #10 ev_b = ev_a;
      end 
    join
  end 
endmodule 

[reporting result]
[20]Thread1: ev_a get triggered

In reply to Marina.Miao:

Section 15.5.5.1 Merging events of the LRM discusses this:

When events are merged, the assignment only affects the execution of subsequent event control or wait operations. If a process is blocked waiting for event1 when another event is assigned to event1, the currently waiting process shall never unblock.

In your case, you are blocking on ev_b. When ev_b is reassigned, the original wait will never unblock.

In reply to cgales:

Hi, Thank you so much, I am clear with that now, so this is the wrong way of events assignment, right?

In reply to cgales:

module tb;
  event ev_a, ev_b;
  
  initial begin 
    fork 
      begin
        wait(ev_a.triggered);
        $display("[%0t]Thread1: ev_a get triggered",$time);
      end 
      
      begin 
        #11;
        wait(ev_b.triggered);
        $display("[%0t]Thread2: ev_b get triggered", $time);
      end 
      
      #20 ->ev_a;
    
      #30 ->ev_b;
   
      
      begin
        #10 ev_b = ev_a;
      end
      
    join
  end 
endmodule 

I change the code, to let the ev_b wait process be later than the event assignment, now it works.