Пример #1
0
        public bool Signal()
        {
            var decrementResult = Interlocked.Decrement(ref count);

            if (decrementResult == 0)
            {
                latch.Set();
                return(true);
            }
            if (decrementResult < 0)
            {
                throw new InvalidOperationException("Attempted to decrement latch beyond zero count.");
            }
            return(false);
        }