1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-02-21 15:54:39 +01:00

Fixing (I hope) race condition in Sizer.java that was preventing the file size from being determined.

This commit is contained in:
David A. Mellis 2009-05-12 13:37:51 +00:00
parent a2b3da7698
commit b11e25ecf2
2 changed files with 22 additions and 4 deletions

View File

@ -57,17 +57,24 @@ public class Sizer implements MessageConsumer {
commandSize[1] = buildPath + File.separator + sketchName + ".hex"; commandSize[1] = buildPath + File.separator + sketchName + ".hex";
int r = 0;
try { try {
exception = null; exception = null;
size = -1; size = -1;
firstLine = null; firstLine = null;
Process process = Runtime.getRuntime().exec(commandSize); Process process = Runtime.getRuntime().exec(commandSize);
new MessageSiphon(process.getInputStream(), this); MessageSiphon in = new MessageSiphon(process.getInputStream(), this);
new MessageSiphon(process.getErrorStream(), this); MessageSiphon err = new MessageSiphon(process.getErrorStream(), this);
boolean running = true; boolean running = true;
while(running) { while(running) {
try { try {
process.waitFor(); if (in.thread != null)
in.thread.join();
if (err.thread != null)
err.thread.join();
r = process.waitFor();
running = false; running = false;
} catch (InterruptedException intExc) { } } catch (InterruptedException intExc) { }
} }
@ -76,7 +83,7 @@ public class Sizer implements MessageConsumer {
// some sub-class has overridden it to do so, thus we need to check for // some sub-class has overridden it to do so, thus we need to check for
// it. See: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1166589459 // it. See: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1166589459
exception = new RunnerException( exception = new RunnerException(
(e.toString() == null) ? e.getClass().getName() : e.toString()); (e.toString() == null) ? e.getClass().getName() + r : e.toString() + r);
} }
if (exception != null) if (exception != null)

View File

@ -48,13 +48,24 @@ UPDATES
0016 0016
[documentation / examples]
* New communication examples (w/ corresponding Processing and Max/MSP code) by
Tom Igoe.
[core / libraries] [core / libraries]
* Adding support for the Arduino Pro and Pro Mini 3.3V / 8 MHz w/ ATmega328.
* Adding write(str) and write(buf, size) methods to Print, Serial, and the * Adding write(str) and write(buf, size) methods to Print, Serial, and the
Ethernet library Client and Server classes. This allows for more efficient Ethernet library Client and Server classes. This allows for more efficient
(fewer packet) Ethernet communication. (Thanks to mikalhart.) (fewer packet) Ethernet communication. (Thanks to mikalhart.)
* Improvements to the way the Ethernet library Client class connects and * Improvements to the way the Ethernet library Client class connects and
disconnects. Should reduce or eliminate failed connections and long disconnects. Should reduce or eliminate failed connections and long
timeouts. (Thanks to Bruce Luckcuck.) timeouts. (Thanks to Bruce Luckcuck.)
* Optimizing the timer0 overflow interrupt handler (used for millis() and
micros()). Thanks to westfw and mikalhart.
[environment]
* Eliminating (maybe) the occasional "Couldn't determine program size" errors.
Thanks to the Clever Monkey.
0015 - 2009.03.26 0015 - 2009.03.26