home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &… the Search for Life CD 3 / 0_CD-ROM.iso / install / jre1_3 / lib / rt.jar / sun / awt / PostEventQueue.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  1.9 KB  |  100 lines

  1. package sun.awt;
  2.  
  3. import java.awt.AWTEvent;
  4. import java.awt.EventQueue;
  5.  
  6. class PostEventQueue extends Thread {
  7.    private static int threadNum = 0;
  8.    private EventQueueItem queueHead = null;
  9.    private EventQueueItem queueTail = null;
  10.    private boolean keepGoing = true;
  11.    private final EventQueue eventQueue;
  12.    // $FF: synthetic field
  13.    static Class class$sun$awt$PostEventQueue;
  14.  
  15.    PostEventQueue(EventQueue var1) {
  16.       super("SunToolkit.PostEventQueue-" + threadNum);
  17.       Class var2 = class$sun$awt$PostEventQueue == null ? (class$sun$awt$PostEventQueue = class$("sun.awt.PostEventQueue")) : class$sun$awt$PostEventQueue;
  18.       synchronized(var2) {
  19.          ++threadNum;
  20.       }
  21.  
  22.       this.eventQueue = var1;
  23.       ((Thread)this).start();
  24.    }
  25.  
  26.    public void run() {
  27.       while(this.keepGoing && !((Thread)this).isInterrupted()) {
  28.          try {
  29.             EventQueueItem var1;
  30.             synchronized(this) {
  31.                while(this.keepGoing && this.queueHead == null) {
  32.                   this.notifyAll();
  33.                   this.wait();
  34.                }
  35.  
  36.                if (!this.keepGoing) {
  37.                   break;
  38.                }
  39.  
  40.                var1 = this.queueHead;
  41.             }
  42.  
  43.             this.eventQueue.postEvent(var1.event);
  44.             synchronized(this) {
  45.                this.queueHead = this.queueHead.next;
  46.                if (this.queueHead == null) {
  47.                   this.queueTail = null;
  48.                }
  49.             }
  50.          } catch (InterruptedException var9) {
  51.             this.keepGoing = false;
  52.             synchronized(this) {
  53.                this.notifyAll();
  54.             }
  55.          }
  56.       }
  57.  
  58.    }
  59.  
  60.    synchronized void postEvent(AWTEvent var1) {
  61.       EventQueueItem var2 = new EventQueueItem(var1);
  62.       if (this.queueHead == null) {
  63.          this.queueHead = this.queueTail = var2;
  64.          this.notifyAll();
  65.       } else {
  66.          this.queueTail.next = var2;
  67.          this.queueTail = var2;
  68.       }
  69.  
  70.    }
  71.  
  72.    void flush() {
  73.       if (Thread.currentThread() != this) {
  74.          synchronized(this) {
  75.             if (this.queueHead != null) {
  76.                try {
  77.                   this.wait();
  78.                } catch (InterruptedException var4) {
  79.                }
  80.             }
  81.  
  82.          }
  83.       }
  84.    }
  85.  
  86.    synchronized void quitRunning() {
  87.       this.keepGoing = false;
  88.       this.notifyAll();
  89.    }
  90.  
  91.    // $FF: synthetic method
  92.    static Class class$(String var0) {
  93.       try {
  94.          return Class.forName(var0);
  95.       } catch (ClassNotFoundException var2) {
  96.          throw new NoClassDefFoundError(((Throwable)var2).getMessage());
  97.       }
  98.    }
  99. }
  100.