Elders.Hystrix.NET.TryableSemaphore.TryAcquire C# (CSharp) Method

TryAcquire() public method

Tries to acquire the semaphore.
public TryAcquire ( ) : bool
return bool
        public bool TryAcquire()
        {
            int currentCount = this.count.IncrementAndGet();
            if (currentCount > this.numberOfPermits.Get())
            {
                this.count.DecrementAndGet();
                return false;
            }
            else
            {
                return true;
            }
        }