anchor.diff:  
   -include_lib("couch/include/couch_db.hrl").
   
  +-define(PROCS, couch_proc_manager_procs).
  +-define(WAITERS, couch_proc_manager_waiters).
  +-define(OPENING, couch_proc_manager_opening).
  +
   -record(state, {
  -    tab,
       config,
  -    proc_counts,
  -    waiting,
  -    threshold_ts
  +    counts,
  +    threshold_ts,
  +    hard_limit,
  +    soft_limit
   }).
   
   -record(client, {
  
positive.code:     t0 = os:timestamp()
  }).
  
  start_link() ->
      gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).
  
  get_proc_count() ->
      gen_server:call(?MODULE, get_proc_count).
  
  get_stale_proc_count() ->
      gen_server:call(?MODULE, get_stale_proc_count).
  
  reload() ->
      gen_server:call(?MODULE, bump_threshold_ts).
  
  terminate_stale_procs() ->
      gen_server:call(?MODULE, terminate_stale_procs).
  
  init([]) ->
      process_flag(trap_exit, true),
      ok = config:listen_for_changes(?MODULE, nil),
      {ok, #state{
          tab = ets:new(procs, [ordered_set, {keypos, #proc_int.pid}]),
          config = get_proc_config(),
          proc_counts = dict:new(),
          waiting = ets:new(couch_proc_manage_waiting,
                  [ordered_set, {keypos, #client.timestamp}])
      }}.
  
  handle_call(get_table, _From, State) ->
      {reply, State#state.tab, State};
  
  handle_call(get_proc_count, _From, State) ->
      {reply, ets:info(State#state.tab, size), State};
  
  handle_call(get_stale_proc_count, _From, State) ->
      #state{tab = Tab, threshold_ts = T0} = State,
      MatchSpec = [{#proc_int{t0='$1', _='_'}, [{'<', '$1', T0}], [true]}],
      {reply, ets:select_count(Tab, MatchSpec), State};
  
  handle_call({get_proc, #doc{body={Props}}=DDoc, DDocKey}, From, State) ->
      {ClientPid, _} = From,
      Lang = couch_util:to_binary(
              couch_util:get_value(<<"language">>, Props, <<"javascript">>)),
      IterFun = fun(Proc, Acc) ->
          case lists:member(DDocKey, Proc#proc_int.ddoc_keys) of
              true ->
                  {stop, assign_proc(State#state.tab, ClientPid, Proc)};
              false ->
                  {ok, Acc}
          end
  
negative.code:     % add ddoc to the proc
      {ok, Proc#proc_int{ddoc_keys=[DDocKey|Keys2]}}.
  
  
  make_proc(Pid, Lang, Mod) when is_binary(Lang) ->
      Proc = #proc_int{
          lang = Lang,
          pid = Pid,
          prompt_fun = {Mod, prompt},
          set_timeout_fun = {Mod, set_timeout},
  