diff options
author | Keith Packard <keithp@keithp.com> | 2011-04-25 21:17:07 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2011-04-25 21:17:07 -0700 |
commit | 2e7b7b80432bb251ac39efa1fa05d32b5f250e14 (patch) | |
tree | 602b6834664e4a5d80a13334fcc4b59ca4958160 /altosui/AltosFlash.java | |
parent | 214cd69c0e4a1617ed5cde8fc2f46a4cee6ecced (diff) |
altosui: Separate out flash debug code to separate thread
This avoids blocking the Swing thread while waiting for the serial
device.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altosui/AltosFlash.java')
-rw-r--r-- | altosui/AltosFlash.java | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/altosui/AltosFlash.java b/altosui/AltosFlash.java index 802adc8c..e91e9806 100644 --- a/altosui/AltosFlash.java +++ b/altosui/AltosFlash.java @@ -28,7 +28,7 @@ import java.text.*; import java.util.prefs.*; import java.util.concurrent.LinkedBlockingQueue; -public class AltosFlash implements Runnable { +public class AltosFlash { File file; FileInputStream input; AltosHexfile image; @@ -252,9 +252,7 @@ public class AltosFlash implements Runnable { throw new IOException("Failed to execute program on target"); } - Thread thread; - - public void run() { + public void flash() { try { if (!check_rom_config()) throw new IOException("Invalid rom config settings"); @@ -333,15 +331,14 @@ public class AltosFlash implements Runnable { } } - public void flash() { - thread = new Thread(this); - thread.start(); + public void close() { + if (debug != null) + debug.close(); } synchronized public void abort() { aborted = true; - if (debug != null) - debug.close(); + close(); } public void addActionListener(ActionListener l) { |