home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 14 / CDACTUAL.iso / ie4 / IE4 / JAVI386.CAB / classr.exe / sun / misc / Lock.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-01-31  |  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.