// programma getest op Pentium III 500 MHz
// programmaduur ongeveer 250 seconden

public class TPoint2 {
	private Point2 p;
	private class Thread1 implements Runnable {
		public void run() {
			System.out.println("Thread1 gestart.");
			for (int i = 0; i < 100000000; i++) {
				p.stepNorthEast();
			}
			System.out.println("Thread1 gestopt.");
		}
	}
	private class Thread2 implements Runnable {
		public void run() {
			int n=0;
			System.out.println("Thread2 gestart.");
			for (int i = 0; i < 100000000; i++) {
				if (!p.isNorthEast())
					System.out.println("Synchronisatie probleem! "+n++);
			}
			System.out.println("Thread2 gestopt.");
		}
	}
	private void doTest() {
		p=new Point2();
		Thread t1=new Thread(new Thread1());
		Thread t2=new Thread(new Thread2());
		t1.start();
		t2.start();
		try {
			t1.join();
			t2.join();
		}
		catch (InterruptedException e) {}
	}
	public static void main(String args[]) {
		TPoint2 t=new TPoint2();
		long starttime=System.currentTimeMillis();
		t.doTest();
		System.out.println("Time passed = "+(System.currentTimeMillis()-starttime)+" msec");
	}
}