protected override void Dispose(bool finalize) { if (Semaphore != null) { Semaphore.Close(); Semaphore = null; } if (RevSemaphore != null) { RevSemaphore.Close(); RevSemaphore = null; } }
public ChoBarrier(int minimumCount, int maximumCount) { if (minimumCount < 0) { throw new ArgumentException("MinimumCount must be >= 0."); } if (maximumCount < 1) { throw new ArgumentException("MaximumCount must be > 1."); } if (minimumCount >= maximumCount) { throw new ArgumentException("MinimumCount must be > MaximumCount."); } Semaphore = new Semaphore(minimumCount, Int32.MaxValue); RevSemaphore = new ChoReverseSemaphore(maximumCount); }