Code example for Condition

Methods: signalAll

0
	public void increase() { 
		lock.lock();
		c++;
		System.out.println(Thread.currentThread().getName()
				+ " increased c to " + c);
		isPositive.signalAll();
		lock.unlock();
	} 
 
	public void decrease() { 
		lock.lock();
		while (c == 0)
			try { 
				System.out.println("c is zero, "
						+ Thread.currentThread().getName() + " is waiting");
				isPositive.await();
				System.out.println("some thread increased c, "
						+ Thread.currentThread().getName()
						+ " is running again"); 
			} catch (InterruptedException e) {
				throw new RuntimeException(e);