summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2010-09-05 01:08:50 -0700
committerKeith Packard <keithp@keithp.com>2010-09-05 01:08:50 -0700
commit6205547ec7191aab0259a8449520e966a96129e6 (patch)
treefb0df8bb10817316c321c4a9bc06106bf2f4df12
parent3d99584fcfe43b22e8581874e0ac77ce3d635d48 (diff)
altosui: When replay thread is interrupted, don't make final report
Normally, the replay process makes one final report after the file has been parsed. However, if the reading process is interrupted to display something else, this report is just annoying, so don't make it. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--ao-tools/altosui/AltosUI.java16
1 files changed, 11 insertions, 5 deletions
diff --git a/ao-tools/altosui/AltosUI.java b/ao-tools/altosui/AltosUI.java
index 6a1814ff..49153766 100644
--- a/ao-tools/altosui/AltosUI.java
+++ b/ao-tools/altosui/AltosUI.java
@@ -384,11 +384,12 @@ public class AltosUI extends JFrame {
AltosRecord read() throws InterruptedException, ParseException, AltosCRCException, IOException { return null; }
- void close() { }
+ void close(boolean interrupted) { }
void update(AltosState state) throws InterruptedException { }
public void run() {
+ boolean interrupted = false;
String line;
AltosState state = null;
AltosState old_state = null;
@@ -418,14 +419,18 @@ public class AltosUI extends JFrame {
}
}
} catch (InterruptedException ee) {
+ interrupted = true;
} catch (IOException ie) {
JOptionPane.showMessageDialog(AltosUI.this,
String.format("Error reading from \"%s\"", name),
"Telemetry Read Error",
JOptionPane.ERROR_MESSAGE);
} finally {
- close();
+ close(interrupted);
idle_thread.interrupt();
+ try {
+ idle_thread.join();
+ } catch (InterruptedException ie) {}
}
}
@@ -446,7 +451,7 @@ public class AltosUI extends JFrame {
return new AltosTelemetry(l.line);
}
- void close() {
+ void close(boolean interrupted) {
serial.close();
serial.remove_monitor(telem);
}
@@ -530,8 +535,9 @@ public class AltosUI extends JFrame {
return null;
}
- public void close () {
- report();
+ public void close (boolean interrupted) {
+ if (!interrupted)
+ report();
}
public ReplayThread(AltosReader in_reader, String in_name) {