anchor.diff:        Error
     end.
   
  +%% @doc Returns `true' if the queue is empty.
   is_empty(Mem) ->
  -  {Res, _Head} = is_empty_segment(Mem),
  -  Res.
  -
  -is_empty_segment(#file_descriptor{} = Mem) ->
  +  case is_empty_queue(Mem) of
  +    {true, _Head} -> true;
  +    false         -> false
  +  end.
  +
  +is_empty_queue(#file_descriptor{} = Mem) ->
     case emmap:pread(Mem, 0, 16) of
       {ok, Header} ->
  -      is_empty_segment(Header);
  +      is_empty_queue(Header);
       {error, Error} ->
         erlang:error(Error)
     end;
  -is_empty_segment(<<_Sz:4/binary, H:32/integer, H:32/integer, _/binary>>) ->
  +is_empty_queue(<<_Sz:4/binary, H:32/integer, H:32/integer, _/binary>>) ->
     {true, H};
  -is_empty_segment(_Header) ->
  +is_empty_queue(_Header) ->
     false.
   
  +%% @doc Get queue length. This function has a linear-time complexity.
   length(Mem) ->
     F = fun
       G(H, T, Count) when H < T ->
  
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:   end;
  
  handle_call(pop, _From, #state{mem=Mem} = State) ->
    Msg = pop_and_purge(Mem),
    {reply, Msg, State};
  
  handle_call(peek, _From, #state{mem=Mem} = State) ->
    Msg = peek(Mem),
    {reply, Msg, State};
  
  handle_call({try_pop, Fun}, _From, #state{mem=Mem} = State) ->
    try
      {reply, {ok, try_pop_and_purge(Mem, Fun)}, State}
    catch _:E:ST ->
      {reply, {error, E, ST}, State}
    end;
  
  handle_call(info, _From, #state{mem=Mem} = State) ->
  