summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
221824b)
This list is access by both the receiver and the monitor task, so it
needs to be locked to prevent collisions.
Signed-off-by: Keith Packard <keithp@keithp.com>
public void printf(String format, Object ... arguments) {
String line = String.format(format, arguments);
public void printf(String format, Object ... arguments) {
String line = String.format(format, arguments);
- if (debug)
- pending_output.add(line);
+ if (debug) {
+ synchronized (pending_output) {
+ pending_output.add(line);
+ }
+ }
try {
print(line);
} catch (InterruptedException ie) {
try {
print(line);
} catch (InterruptedException ie) {
- public void flush_output() {
+ public synchronized void flush_output() {
if (pending_output == null)
return;
if (pending_output == null)
return;
- for (String s : pending_output)
- System.out.print(s);
- pending_output.clear();
+ synchronized (pending_output) {
+ for (String s : pending_output)
+ System.out.print(s);
+ pending_output.clear();
+ }
}
public void flush_input(int timeout) throws InterruptedException {
}
public void flush_input(int timeout) throws InterruptedException {