Clearing out process mailbox - is using :c.flush() a good idea?

You can write a flush_exits like so:

defp flush_exits do
  receive do
    {:EXIT, _, _} -> flush_exits()
    {:EXIT, _} -> flush_exits()
  after
    0 -> :ok
  end
end

This will selectively remove exits from the mailbox, returning when there are none left. :slight_smile: