// A simple barrier. // (c) 1997 duane a. bailey. package element; /** * Copyright (c) 1997 McGraw-Hill * All Rights Reserved. *

* Permission to use, copy, modify, and distribute this * software and its documentation for NON-COMMERCIAL purposes * and without fee is hereby granted provided that this * copyright notice appears in all copies. Please refer to * the file "copyright.html" for further important copyright * and licensing information. *

* MCGRAW-HILL MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE * SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR * NON-INFRINGEMENT. MCGRAW-HILL SHALL NOT BE LIABLE FOR ANY DAMAGES * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. * @version $Id: Barrier.java,v 2.1 1999/07/11 02:52:16 bailey Exp $ * @author duane a. bailey */ class Barrier { /** */ public Barrier() { } synchronized public void P() // post: awaits allocation of a resource { try { wait(); } catch (java.lang.InterruptedException e) {}; } synchronized public void V() // post: frees resource { notifyAll(); } }