//import be.ac.vub.ir.util.Chrono; public class ObjectAsMonitor { public synchronized void f1(){ try { Thread.sleep(100); } catch (InterruptedException e) {} } public synchronized void f2(){ try { Thread.sleep(100); } catch (InterruptedException e) {} } /** * @param args * @throws InterruptedException */ public static void main(String[] args) throws InterruptedException { // Chrono chrono = new Chrono(); long t1 = System.nanoTime(); final ObjectAsMonitor monitor = new ObjectAsMonitor(); final int NBR_THREADS=4, NBR_ITERATIONS=10; Thread[] threads = new Thread[NBR_THREADS]; for(int i=0;i