···9797 exit(reason)
98989999 ^root_pid ->
100100- # The root has died, end the simulation
100100+ # The root died, end the simulation
101101 end_simulation(state, reason)
102102 {:noreply, state}
103103104104 _ ->
105105 killed = Trinity.Scheduler.handle_down(sim, from, reason)
106106107107- Enum.each(killed, fn pid ->
108108- # Flush exit messages for (simulated) linked processes
109109- receive do
110110- {:EXIT, ^pid, _reason} -> :noop
111111- end
112112-113113- # If the root was killed, end the simulation
114114- case pid == root_pid do
115115- true -> end_simulation(state, reason)
116116- _ -> :noop
117117- end
118118- end)
107107+ case root_pid in killed do
108108+ # The root was linked and therefore killed, end the simulation
109109+ true -> end_simulation(state, reason)
110110+ _ -> :noop
111111+ end
119112120113 {:noreply, state}
121114 end