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";
int r = 0;
try {
exception = null;
size = -1;
firstLine = null;
Process process = Runtime.getRuntime().exec(commandSize);
new MessageSiphon(process.getInputStream(), this);
new MessageSiphon(process.getErrorStream(), this);
MessageSiphon in = new MessageSiphon(process.getInputStream(), this);
MessageSiphon err = new MessageSiphon(process.getErrorStream(), this);
boolean running = true;
while(running) {
try {
process.waitFor();
if (in.thread != null)
in.thread.join();
if (err.thread != null)
err.thread.join();
r = process.waitFor();
running = false;
} 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
// it. See: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1166589459
exception = new RunnerException(
(e.toString() == null) ? e.getClass().getName() : e.toString());
(e.toString() == null) ? e.getClass().getName() + r : e.toString() + r);
}
if (exception != null)

View File

@ -48,13 +48,24 @@ UPDATES
0016
[documentation / examples]
* New communication examples (w/ corresponding Processing and Max/MSP code) by
Tom Igoe.
[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
Ethernet library Client and Server classes. This allows for more efficient
(fewer packet) Ethernet communication. (Thanks to mikalhart.)
* Improvements to the way the Ethernet library Client class connects and
disconnects. Should reduce or eliminate failed connections and long
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