anchor.diff:  wait(Name, _Version) ->
       %% @todo Hopefully, the scheduler will provide enough of a delay.
       erlang:yield(),
  +    %% @todo Warn when NewVersion =:= Version
       ets:lookup_element(Name, version, 2).
   
   
  
positive.code: take(_N, _Name, infinity, _Version) ->
      ok;
  take(N, Name, Limit, Version) when N >= 0 ->
      case ets:update_counter(Name, tokens, {2,N}) of
          %% Limit exceeded. Keep the amount of tokens that we did
          %% manage to take before exceeding the limit.
          Tokens when Tokens >= Limit ->
              Over = Tokens - Limit,
              Under = N - Over,
              NewVersion = wait(Name, Version),
              %% @todo Warn when NewVersion =:= Version
              take(N-Under, Name, Limit, NewVersion);
          Tokens when Tokens < Limit ->
              %% Use difference between token counter and the token limit
              %% to compute the probability of a message being delayed.
              %% Add one token to the difference to ensure that a message
              %% has a 50% chance, instead of 0%, of being sent when difference
              %% is one token.
              Distance = Limit - Tokens,
              case random:uniform(Distance) of
                  1 ->
                      %% Ensure that the token counter is never negative. We will loose
                      %% some tokens if the token counter was reset inbetween.
                      ets:update_counter(Name, tokens, {2,-N,0,0}),
                      NewVersion = wait(Name, Version),
                      take(N, Name, Limit, NewVersion);
                  _ ->
                      ok
              end
      end.
  
negative.code:         {version, 0},
          {limit, Limit},
          {fair, Limit},
          {tokens, Limit},
          {timer, TRef}]),
      ok.
  
  