/**
 * CriticalSection.java
 *
 * A solution to the Critical Section Problem 
 * using monitors
 *
 * @author Jalal Kawash
 * @version 1.0 - February 7, 2001
 * 
 */


public class CriticalSection {

     public synchronized void critical(int id) {
	System.out.print("([" + id + "]" );
	try {
	     Thread.sleep( (int) (Math.random() * 3000));
	}
	catch (InterruptedException e) {}
	System.out.println("[" + id + "])" );
    }

}
     

