public MonitorBasedSemaphore(int initial) { m = new StReentrantLock(); cv = new StConditionVariable(m); if (initial > 0) { permits = initial; } }
public MonitorBasedLinkedBlockingQueue(int capacity) { if (capacity <= 0) { throw new ArgumentException("capacity"); } this.capacity = capacity; buffer = new Queue <T>(capacity); m = new StReentrantLock(); cv = new StConditionVariable(m); }
public MonitorBasedLinkedBlockingQueue2(int capacity) { if (capacity <= 0) { throw new ArgumentException("capacity"); } this.capacity = capacity; buffer = new Queue <T>(capacity); nonFull = new StConditionVariable(m); nonEmpty = new StConditionVariable(m); }