summaryrefslogtreecommitdiff
path: root/altosui/AltosSerial.java
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-08-13 21:10:15 -0700
committerKeith Packard <keithp@keithp.com>2011-08-13 21:10:15 -0700
commit924d56a4d2d8b16530cd378b18cfc5d6e08420ed (patch)
tree5ef26000b726f86d861c9838f706382df72d2a36 /altosui/AltosSerial.java
parentdcd15032eec45f3fdd003050710ebd5b85052662 (diff)
altos: AltosSerial.flush_input shouldn't discard Interrupted exceptions
The eeprom download code wants to interrupt serial communication so that it can stop downloading stuff in the middle of a run. Make flush_input pass the exception along instead of discarding it. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altosui/AltosSerial.java')
-rw-r--r--altosui/AltosSerial.java17
1 files changed, 9 insertions, 8 deletions
diff --git a/altosui/AltosSerial.java b/altosui/AltosSerial.java
index b089c9c4..f0e25fa5 100644
--- a/altosui/AltosSerial.java
+++ b/altosui/AltosSerial.java
@@ -187,7 +187,7 @@ public class AltosSerial implements Runnable {
return abort;
}
- public void flush_input() {
+ public void flush_input() throws InterruptedException {
flush_output();
boolean got_some;
@@ -195,10 +195,7 @@ public class AltosSerial implements Runnable {
if (remote)
timeout = 500;
do {
- try {
- Thread.sleep(timeout);
- } catch (InterruptedException ie) {
- }
+ Thread.sleep(timeout);
got_some = !reply_queue.isEmpty();
synchronized(this) {
if (!"VERSION".startsWith(line) &&
@@ -271,8 +268,12 @@ public class AltosSerial implements Runnable {
}
public void close() {
- if (remote)
- stop_remote();
+ if (remote) {
+ try {
+ stop_remote();
+ } catch (InterruptedException ie) {
+ }
+ }
if (in_reply != 0)
System.out.printf("Uh-oh. Closing active serial device\n");
@@ -422,7 +423,7 @@ public class AltosSerial implements Runnable {
remote = true;
}
- public void stop_remote() {
+ public void stop_remote() throws InterruptedException {
if (debug)
System.out.printf("stop remote\n");
try {