diff options
author | Keith Packard <keithp@keithp.com> | 2013-12-18 01:14:11 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2013-12-18 01:14:11 -0800 |
commit | e26306c9350ef1d107d4257ef1c09d15165c9154 (patch) | |
tree | d7983c6a04c54b3307d6fc2699dad4fa21d8bde0 /altoslib/AltosSelfFlash.java | |
parent | 18852efa108ba6e6e69dfd5076d4f4c01f62b4ef (diff) |
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 <keithp@keithp.com>
Diffstat (limited to 'altoslib/AltosSelfFlash.java')
-rw-r--r-- | altoslib/AltosSelfFlash.java | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/altoslib/AltosSelfFlash.java b/altoslib/AltosSelfFlash.java index 07952d7f..327a90bd 100644 --- a/altoslib/AltosSelfFlash.java +++ b/altoslib/AltosSelfFlash.java @@ -130,7 +130,10 @@ public class AltosSelfFlash extends AltosProgrammer { public void close() { if (link != null) { reboot(); - link.close(); + try { + link.close(); + } catch (InterruptedException ie) { + } link = null; } } @@ -140,7 +143,7 @@ public class AltosSelfFlash extends AltosProgrammer { close(); } - private AltosHexfile get_rom() { + private AltosHexfile get_rom() throws InterruptedException { System.out.printf("get rom\n"); try { int base = AltosRomconfig.fetch_base(image); @@ -152,15 +155,13 @@ public class AltosSelfFlash extends AltosProgrammer { } catch (AltosNoSymbol none) { System.out.printf("no symbol %s\n", none.getMessage()); return null; - } catch (InterruptedException ie) { - return null; } catch (IOException ie) { return null; } } - public boolean check_rom_config() { + public boolean check_rom_config() throws InterruptedException { if (link == null) { System.out.printf ("no link\n"); return true; @@ -177,7 +178,7 @@ public class AltosSelfFlash extends AltosProgrammer { rom_config = romconfig; } - public AltosRomconfig romconfig() { + public AltosRomconfig romconfig() throws InterruptedException { System.out.printf("fetch romconfig\n"); if (!check_rom_config()) return null; |