public static void main(String[] args) throws InterruptedException{
		VolatileDemo demo=new VolatileDemo();
		int threadNum=100;
		CountDownLatch threadSignal = new CountDownLatch(threadNum);
		Worker worker=new Worker(demo,false,threadSignal);
		Thread[] ts=new Thread[threadNum];
		long start=System.nanoTime();
		for(int i=0;i<ts.length;i++){
			ts[i]=new Thread(worker);
			ts[i].start();
		}
		threadSignal.await();
		//demo.stop();
		System.out.println(System.nanoTime()-start);
		threadSignal = new CountDownLatch(threadNum);
		Worker worker1=new Worker(demo,true,threadSignal);
		start=System.nanoTime();
		for(int i=0;i<ts.length;i++){
			ts[i]=new Thread(worker1);
			ts[i].start();
		}
		threadSignal.await();
		//demo.synStop();
		System.out.println(System.nanoTime()-start);
	}