home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1997 August / PCO0897.ISO / browser / tonline / ie32.exe / IEXPLORE.CAB / CLASSES.ZIP / sun / misc / Lock.class (.txt) < prev    next >
Encoding:
Java Class File  |  1996-10-01  |  512 b   |  19 lines

  1. package sun.misc;
  2.  
  3. public class Lock {
  4.    private boolean locked = false;
  5.  
  6.    public final synchronized void lock() throws InterruptedException {
  7.       while(this.locked) {
  8.          this.wait();
  9.       }
  10.  
  11.       this.locked = true;
  12.    }
  13.  
  14.    public final synchronized void unlock() {
  15.       this.locked = false;
  16.       this.notifyAll();
  17.    }
  18. }
  19.