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();
}
}