Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.Implementation.QuickPulse.Helpers.QuickPulseQuotaTracker.UseQuota C# (CSharp) 메소드

UseQuota() 개인적인 메소드

private UseQuota ( ) : bool
리턴 bool
        private bool UseQuota()
        {
            var spin = new SpinWait();

            while (true)
            {
                float originalValue = Interlocked.CompareExchange(ref this.currentQuota, 0, 0);

                if (originalValue < 1f)
                {
                    return false;
                }

                float newValue = originalValue - 1f;

                if (Interlocked.CompareExchange(ref this.currentQuota, newValue, originalValue) == originalValue)
                {
                    return true;
                }

                spin.SpinOnce();
            }
        }