Slide 27
Slide 27 text
Elixir philosopher
defmodule Philosopher do
use GenServer
def handle_cast(:forks, from, state) do
eat()
send(from, :done_eating)
think()
{:noreply, state}
end
def handle_cast(:no_forks, from, state) do
think()
{:noreply, state}
end
end
27