RavenFS.Synchronization.SynchronizationHiLo.NextId C# (CSharp) Метод

NextId() публичный Метод

public NextId ( ) : long
Результат long
		public long NextId()
		{
			var incrementedCurrentLow = Interlocked.Increment(ref currentLo);
			if (incrementedCurrentLow > Capacity)
			{
				lock (generatorLock)
				{
					if (Thread.VolatileRead(ref currentLo) > Capacity)
					{
						currentHi = GetNextHi();
						currentLo = 1;
						incrementedCurrentLow = 1;
					}
				}
			}
			return (currentHi - 1)*Capacity + (incrementedCurrentLow);
		}