use GenServer end iex> {:ok, pid} = GenServer.start(MyCallback, []) defmodule GenServer do defmacro __using__(_) do quote do @behaviour :gen_server ! def init(args), do: {:ok, args} ! def handle_cast(msg, state), do: {:stop, {:bad_cast, msg}, state} ! def handle_call(msg, _from, state), do: {:stop, {:bad_call, msg}, state} ! def handle_info(_msg, state), do: {:noreply, state} ! def terminate(_reason, _state), do: :ok ! def code_change(_old, state, _extra), do: {:ok, state} ! defoverridable [init: 1, handle_call: 3, handle_info: 2, handle_cast: 2, terminate: 2, code_change: 3] end end … end