anchor.diff:  %% @hidden
   %%--------------------------------------------------------------------
   init([]) ->
  -	{ok, []}.
  +    ets:new(?MODULE, [protected, named_table, set]),
  +    {ok, []}.
   
   %%--------------------------------------------------------------------
   %% Function: %% handle_call(Request, From, State) -> {reply, Reply, State} |
  
positive.code: %% @hidden
  %%--------------------------------------------------------------------
  handle_cast(clear_all, State) ->
      Local = node(),
      [global:del_lock({ChannelId, Node}, [Node|nodes()]) || {ChannelId, Node, _Pids} <- ets:tab2list(global_locks), Node == Local],
      {noreply, State};
  
  handle_cast(_Msg, State) ->
  
negative.code: -export([start_link/0, init/1, handle_call/3, handle_cast/2, 
  	     handle_info/2, terminate/2, code_change/3]).
  
  -export([lock/1, set_lock/1, clear_all/0]).
  
  -include_lib("logplex.hrl").
  
  -define(TIMEOUT, 10000).
  
  %% API functions
  start_link() ->
      gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).
  
  lock(ChannelId) when is_integer(ChannelId) ->
      Nodes = lists:sort([node()|nodes()]),
      Index = (ChannelId rem length(Nodes)) + 1,
      Node = lists:nth(Index, Nodes),
      case rpc:call(Node, ?MODULE, set_lock, [ChannelId], ?TIMEOUT) of
          {badrpc, Reason} ->
              error_logger:error_msg("badrpc (~p): ~p~n", [Node, Reason]),
              true;
          Res ->
              Res
      end.
  
  set_lock(ChannelId) when is_integer(ChannelId) ->
      gen_server:call(?MODULE, {set_lock, ChannelId}, ?TIMEOUT).
  
  clear_all() ->
      gen_server:abcast([node()|nodes()], ?MODULE, clear_all).
  
  %%====================================================================
  %% gen_server callbacks
  