public void Add(int count) { lock (this) { if (count < 0) { throw new ArgumentOutOfRangeException(); } if (CurrentCount > 0) { CurrentCount += count; } else { CurrentCount = count; #if SNAPPY_ASYNC Available.SetResult(null); #else Available.Set(); #endif } } }