-public class AltosSerial implements Runnable {
- FileInputStream serial_in = null;
- FileOutputStream serial_out = null;
- AltosSerialReader reader;
- LinkedList<AltosSerialMonitor> callbacks;
-
- public void run() {
- for (;;) {
- String s = reader.get_reply();
- synchronized(callbacks) {
- Iterator<AltosSerialMonitor> i = callbacks.iterator();
- while (i.hasNext()) {
- i.next().data(s);
- }
+ public void close() {
+ if (altos != null)
+ libaltos.altos_close(altos);
+ if (input_thread != null) {
+ try {
+ input_thread.interrupt();
+ input_thread.join();
+ } catch (InterruptedException e) {