package garden;

/**
 * @author ssb
 */
public class SimpleGardenDemo {

	/**
	 * @param args
	 */
	public static void main ( String[] args ) {
		for ( int reps = 0 ; reps < 10 ; reps++ ) {

			Counter counter = new SimpleCounter();

			Thread thread1 = new Thread(new Entrance(counter,100));
			thread1.start();

			Thread thread2 = new Thread(new Entrance(counter,100));
			thread2.start();

			for ( ; thread1.isAlive() ; ) {
				try {
					thread1.join();
				} catch ( InterruptedException e ) {}
			}
			for ( ; thread2.isAlive() ; ) {
				try {
					thread2.join();
				} catch ( InterruptedException e ) {}
			}

			System.out.println("counter value: " + counter.getValue()
			    + (counter.getValue() != 200 ? "  *" : ""));
		}
	}

}
