anchor.diff:    enqueue(Pid,  c),
   
     ?assertEqual(a,   dequeue(Pid)),
  +  ?assertEqual(b,   inspect(Pid)),
     ?assertEqual(b,   dequeue(Pid)),
  -  ?assertEqual(c,   dequeue(Pid)),
  +  ?assertError(failed, try_dequeue(Pid, fun(c) -> erlang:error(failed) end)),
  +  ?assertEqual(c,   try_dequeue(Pid, fun(c) -> c end)),
     ?assertEqual(nil, dequeue(Pid)),
   
     Blob = list_to_binary(string:copies("x", 256)),
  
positive.code:        Error
    end)(Arg).
  
  pop(Mem) ->
    case pop_internal(Mem) of
      {Msg, _IsLastdt} ->
        Msg;
      nil ->
        nil
    end.
  
  pop_and_purge(Mem) ->
    case pop_internal(Mem) of
      {Msg, true} ->
        ok = emmap:pwrite(Mem, 4, ?INIT_SEGM_HEADER),
        Msg;
  
negative.code:   , segm_sz  :: non_neg_integer()
  }).
  
  -define(TIMEOUT, infinity).
  
  %%------------------------------------------------------------------------------
  %% Gen_server API
  %%------------------------------------------------------------------------------
  
  %% @doc Start a queue process.
  %% `Name' - name of the registered process.
  %% `Filename' - name of the memory mapped file.
  %% `SegmSize' - size of the memory mapped segment (can be 0 for an existing file).
  %% `Opts' - see `emmap:open_options()'.
  start_link(Name, Filename, SegmSize, Opts) when is_list(Opts) ->
    gen_server:start_link({local, Name}, ?MODULE, [Filename, SegmSize, Opts], []).
  
  %% @doc Enqueue a message to the queue
  enqueue(Name, Term) ->
    gen_server:call(Name, {push, Term}, ?TIMEOUT).
  
  %% @doc Dequeue a message from the queue
  dequeue(Name) ->
    gen_server:call(Name, pop, ?TIMEOUT).
  
  %% @doc Dequeue a message from the queue.
  %% The function returns `Res' where `Res' is the result of evaluating
  %% the `Fun' with the poped element from the queue.  If the `Fun' throws an
  %% exception, the exception if propagated to the caller.
  try_dequeue(Name, Fun) when is_function(Fun, 1) ->
    case gen_server:call(Name, {try_pop, Fun}, ?TIMEOUT) of
      {ok, Res} ->
        Res;
      {error, Error, Stacktrace} ->
        erlang:error(Error, Stacktrace)
    end.
  
  %% @doc Peek a message from the queue without dequeuing it
  inspect(Name) ->
    gen_server:call(Name, peek, ?TIMEOUT).
  
  %% @doc Return queue info as a map
  -spec info(atom()) -> map().
  info(Name) ->
    gen_server:call(Name, info, ?TIMEOUT).
  
  %%------------------------------------------------------------------------------
  %% Gen_server callbacks
  