Esempio n. 1
0
        /// <summary>
        /// Mark the passage of time and decay the current rate accordingly.
        /// </summary>
        public void Tick()
        {
            var count       = _uncounted.GetAndSet(0);
            var instantRate = count / _interval;

            if (_initialized)
            {
                _rate += _alpha * (instantRate - _rate);
            }
            else
            {
                _rate.Set(instantRate);
                _initialized = true;
            }
        }
Esempio n. 2
0
		/// <summary>
		/// Mark the passage of time and decay the current rate accordingly.
		/// </summary>
		public void Tick()
		{
			var count = _uncounted.GetAndSet(0);
			var instantRate = count / _interval;
			if (_initialized)
			{
				_rate += _alpha * (instantRate - _rate);
			}
			else
			{
				_rate.Set(instantRate);
				_initialized = true;
			}
		}
Esempio n. 3
0
 private static VolatileDouble Add(VolatileDouble left, VolatileDouble right)
 {
     left.Set(left.Get() + right.Get());
     return(left.Get());
 }
Esempio n. 4
0
		private static VolatileDouble Add(VolatileDouble left, VolatileDouble right)
		{
			left.Set(left.Get() + right.Get());
			return left.Get();
		}