anchor.diff:  
                        pid  :: undefined | pid(),
                        mref :: undefined | reference() }).
  +
  +-type pred_fun()      :: fun ((State :: term()) -> false | term()).
  +-type timeout_fun()   :: fun ((State :: term()) -> handler_result()).
  +-type cond_body_fun() :: fun ((PredResult :: term(), State :: term()) ->
  +                                     handler_result()).
  +
  +-record(condition, { id    :: reference(),
  +                     timer :: misc:timer(),
  +                     pred  :: pred_fun(),
  +
  +                     on_timeout :: timeout_fun(),
  +                     on_success :: cond_body_fun() }).
   
   -callback init(Args :: term()) ->
       {ok, State :: term()} | {ok, State :: term(), timeout() | hibernate} |
  
positive.code: -export([abort_queue/1, abort_queue/3]).
  -export([get_active_queues/0]).
  
  %% gen_server callbacks
  -export([init/1, handle_call/3, handle_cast/2, handle_info/2,
           terminate/2, code_change/3]).
  
negative.code: get_active_queues() ->
      lists:map(_#async_job.queue, get_active_jobs()).
  
  conditional(Pred, OnSuccess) ->
      add_condition(Pred, OnSuccess, infinity, undefined).
  
  conditional(Pred, OnSuccess, Timeout, OnTimeout) ->
      true = is_integer(Timeout),
      add_condition(Pred, OnSuccess, Timeout, OnTimeout).
  
  %% gen_server callbacks
  init([Module, Args]) ->
      set_state(module, Module),
      Module:init(Args).
  
  handle_call(Request, From, State) ->
      check_conditions((get_module()):handle_call(Request, From, State)).
  
  handle_cast(Msg, State) ->
      check_conditions((get_module()):handle_cast(Msg, State)).
  
  handle_info(Info, State) ->
      check_conditions(do_handle_info(Info, State)).
  
  do_handle_info({'$gen_server2', condition_expired, Id}, State) ->
      handle_condition_expired(Id, State);
  do_handle_info({'$gen_server2', job_result, Queue, Result}, State) ->
      handle_job_result(Queue, Result, State);
  do_handle_info({'DOWN', MRef, process, _Pid, Reason} = Info, State) ->
      case get_active_job(#async_job.mref, MRef) of
          {ok, Job} ->
              case call_handle_job_death(Job, Reason) of
  