Без Selective Receive
defmodule Receiver do
def loop() do
Process.sleep(100)
receive do
{:high_priority, pid, ref, msg} -> send(pid, {ref, :high})
{:low_priority, pid, ref, msg} -> send(pid, {ref, :low})
end
loop()
end
end
pid = spawn(Receiver, :loop, [])
send(pid, {:low_priority, self(), make_ref(), :hello})
send(pid, {:low_priority, self(), make_ref(), :hello})
send(pid, {:high_priority, self(), make_ref(), :HELLO})
flush()