From e26306c9350ef1d107d4257ef1c09d15165c9154 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 18 Dec 2013 01:14:11 -0800 Subject: altoslib: Pass InterruptedException up the stack instead of hiding it When interrupting a thread that is talking to a serial device, it's important not to have that thread discard the InterruptedException so that it will actually terminate. This patch removes a bunch of places that were discarding InterruptedExceptions and lets higher level code see them so that they can exit cleanly. Signed-off-by: Keith Packard --- altosui/AltosSerial.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'altosui/AltosSerial.java') diff --git a/altosui/AltosSerial.java b/altosui/AltosSerial.java index b85a7fa1..5e9322e5 100644 --- a/altosui/AltosSerial.java +++ b/altosui/AltosSerial.java @@ -146,7 +146,7 @@ public class AltosSerial extends AltosLink { try { input_thread.interrupt(); input_thread.join(); - } catch (InterruptedException e) { + } catch (InterruptedException ie) { } input_thread = null; } @@ -156,18 +156,16 @@ public class AltosSerial extends AltosLink { private void putc(char c) { if (altos != null) - if (libaltos.altos_putchar(altos, c) != 0) { + if (libaltos.altos_putchar(altos, c) != 0) close_serial(); - } } public void putchar(byte c) { if (altos != null) { if (debug) System.out.printf(" %02x", (int) c & 0xff); - if (libaltos.altos_putchar(altos, (char) c) != 0) { + if (libaltos.altos_putchar(altos, (char) c) != 0) close_serial(); - } } } -- cgit v1.2.3