home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1998 September / dppcpro0998.iso / Rwc / Sybase / Install.exe / samples.z / CounterThread.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-03-25  |  458 b   |  24 lines

  1. public class CounterThread extends Thread {
  2.    private Form_Threads _parent;
  3.    private int _threadNumber;
  4.    private int _counter;
  5.  
  6.    public CounterThread(Form_Threads var1, int var2) {
  7.       this._parent = var1;
  8.       this._threadNumber = var2;
  9.    }
  10.  
  11.    public void run() {
  12.       while(true) {
  13.          ++this._counter;
  14.          if (this._counter > 1000) {
  15.             this._counter = 0;
  16.          }
  17.  
  18.          synchronized(this) {
  19.             this._parent.updateCounter(this._threadNumber, this._counter);
  20.          }
  21.       }
  22.    }
  23. }
  24.