public class InterpreterProcess extends FleetProcess implements Runnable {
private Instruction[] instructions;
public void flush() { }
- public void sendWord(Destination d, BitVector word) {
+ public synchronized void sendWord(Destination d, BitVector word) {
InterpreterPath path = (InterpreterPath)debugShip.getDock("in").getPath(d, new BitVector(1));
((InterpreterDestination)d).
addDataFromFabric(new Packet(path, word, false));
}
- public void sendToken(Destination d) {
+ public synchronized void sendToken(Destination d) {
InterpreterPath path = (InterpreterPath)debugShip.getDock("in").getPath(d, new BitVector(1));
((InterpreterDestination)d).
addDataFromFabric(new Packet(path, new BitVector(getWordWidth()), true));
protected void _terminate() { }
public void run() {
try {
- while(!isTerminated())
+ while(!isTerminated()) {
for(InterpreterShip ship : ships.values())
for(int j=0; j<10; j++)
- ship._service();
+ synchronized(this) {
+ ship._service();
+ }
+ }
for(InterpreterShip ship : ships.values())
ship.reset();
debugStream.clear();
}
}
- public void step(Dock d) {
+ public synchronized void step(Dock d) {
((InterpreterDock)d).service();
}
- public void step(Ship s) {
+ public synchronized void step(Ship s) {
((InterpreterShip)s).service();
}