altosui: Initialize display thread state in constructor instead of run
authorKeith Packard <keithp@keithp.com>
Sat, 20 Nov 2010 08:09:03 +0000 (00:09 -0800)
committerKeith Packard <keithp@keithp.com>
Sat, 20 Nov 2010 08:09:03 +0000 (00:09 -0800)
Some state will get set before run is called, initializing it there
can be too late.

Signed-off-by: Keith Packard <keithp@keithp.com>
ao-tools/altosui/AltosDisplayThread.java

index 375965b904d68364e495a3c2081ab0de46dbad64..3e719130a6a7c67475f41d98a8740b9904e66e01 100644 (file)
@@ -116,10 +116,6 @@ public class AltosDisplayThread extends Thread {
                }
 
                public void run () {
                }
 
                public void run () {
-
-                       reported_landing = 0;
-                       state = null;
-                       report_interval = 10000;
                        try {
                                for (;;) {
                                        set_report_time();
                        try {
                                for (;;) {
                                        set_report_time();
@@ -159,6 +155,12 @@ public class AltosDisplayThread extends Thread {
                        } else if (spoken)
                                set_report_time();
                }
                        } else if (spoken)
                                set_report_time();
                }
+
+               public IdleThread() {
+                       state = null;
+                       reported_landing = 0;
+                       report_interval = 10000;
+               }
        }
 
        boolean tell(AltosState state, AltosState old_state) {
        }
 
        boolean tell(AltosState state, AltosState old_state) {