anchor.diff:  %% @doc Similar to `put(Name, Value, Pid)' but only allows for one single registration.
   %% Returns `true' if this registration has succeded, or `false' if another process
   %% has already registered this name.
  --spec reg(term(), term(), pid()) -> true | {false, pid()}.
  -reg(Name, Value, Pid) -> 
  +-spec reg(term(), term(), pid()) -> true | {false, pid()} | timeout.
  +reg(Name, Value, Pid) when is_pid(Pid) -> 
       case ets:insert_new(nklib_proc_store,  {Name, [{val, Value, Pid}]}) of
           true -> 
               put(Name, Value, Pid),
               true;
           false ->
  -            gen_server:call(?MODULE, {reg, Name, Value, Pid})
  -    end.
  -
  -
  -%% @doc Similar to `reg(Name, Value, Pid)', but, in case other process has already
  -%% registered this name, waits for it to be unregistered and then we are automatically
  +            timed_call({reg, Name, Value, Pid}, 5000)
  +    end.
  +
  +
  +%% @doc Similar to `reg(Name, Value, Pid)', but, in case other process have already
  +%% registered this name, it waits for it to be unregistered and then we are automatically
   %% registered. 
   -spec reg(term(), term(), pid(), integer()|infinity) -> true | timeout.
  -reg(Name, Value, Pid, Timeout) ->
  -    case catch gen_server:call(?MODULE, {wait_reg, Name, Value, Pid}, Timeout) of
  +reg(Name, Value, Pid, Timeout) when is_pid(Pid) ->
  +    case timed_call({wait_reg, Name, Value, Pid}, Timeout) of
           ok -> true;
  -        _ -> timeout
  +        timeout -> timeout
       end.
   
       
  
positive.code: %% ===================================================================
  
  %% @private
  -spec register(term(), val|put|del|reg, term(), pid()) -> true.
  register(Name, Type, Value, Pid) ->
      insert_pid(Pid, Type, Name),
      NameItems = case lookup_store(Name) of
          [] -> 
              [{Type, Value, Pid}];
          OldNameItems -> 
              NameItemsR = [{T, V, P} || {T, V, P } <- OldNameItems,
                                         T/=Type orelse P/=Pid],
              case Type of
                  reg -> NameItemsR ++ [{Type, Value, Pid}];
                  _ -> [{Type, Value, Pid}|NameItemsR]
              end
      end,
      case Type of
  
negative.code: %% @doc Waits for `Name' to be unregistered from all pids before `Timeout'.
  -spec wait_del(term(),  integer()|infinity) -> ok | timeout.
  wait_del(Name, Timeout) ->
      timed_call({wait_del, Name}, Timeout).
  
  
  %% @doc Process registration compatible with `global:register_name/2'.
  