anchor.diff:              not_found
       end.
   
  -enqueue_job(Queue, Body, HandleResult) ->
  +enqueue_job(Queue, Name, Body, HandleResult) ->
       Job = #async_job{body          = Body,
                        handle_result = HandleResult,
  -                     queue         = Queue},
  +                     queue         = Queue,
  +                     name          = Name},
   
       update_state({queue, Queue},
                    queue:in(Job, _),
                    queue:new()).
  +
  +set_queue(Queue, Value) ->
  +    case queue:is_empty(Value) of
  +        true ->
  +            del_state({queue, Queue});
  +        false ->
  +            set_state({queue, Queue}, Value)
  +    end.
   
   dequeue_job(Queue) ->
       case get_state({queue, Queue}) of
  
positive.code: -export([enter_loop/3, enter_loop/4, enter_loop/5]).
  
  %% gen_server2-specific APIs
  -export([async_job/2, async_job/3]).
  
  %% gen_server callbacks
  -export([init/1, handle_call/3, handle_cast/2, handle_info/2,
  
negative.code:         Q ->
              true = queue:is_queue(Q),
              {{value, Job}, NewQ} = queue:out(Q),
              set_queue(Queue, NewQ),
  
              {ok, Job}
      end.
  
  dequeue_same_name_jobs(Name, Queue) ->
      Jobs = get_state({queue, Queue}, queue:new()),
  
      {Matching, Rest} = out_while(?cut(_#async_job.name =:= Name), Jobs),
      set_queue(Queue, Rest),
      queue:to_list(Matching).
  
  out_while(Pred, Q) ->
      out_while(Pred, Q, queue:new()).
  
  out_while(Pred, Q, AccQ) ->
      case queue:out(Q) of
          {empty, _} ->
              {AccQ, Q};
          {{value, V}, NewQ} ->
              case Pred(V) of
                  true ->
                      out_while(Pred, NewQ, queue:in(V, AccQ));
                  false ->
                      {AccQ, Q}
              end
      end.
  
  maybe_start_job(Queue) ->
  