From: adam Date: Mon, 17 Nov 2008 01:36:16 +0000 (+0100) Subject: decouple the insertion of shutdown commands from the readback of shutdown tokens X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=25ac99d23d7aff1ce388a250d102e544fcaa6e00;p=fleet.git decouple the insertion of shutdown commands from the readback of shutdown tokens --- diff --git a/src/edu/berkeley/fleet/ir/Process.java b/src/edu/berkeley/fleet/ir/Process.java index a6b017a..df3add3 100644 --- a/src/edu/berkeley/fleet/ir/Process.java +++ b/src/edu/berkeley/fleet/ir/Process.java @@ -1,4 +1,5 @@ package edu.berkeley.fleet.ir; +import java.util.concurrent.Semaphore; import java.util.*; import java.net.*; import edu.berkeley.fleet.two.*; @@ -726,15 +727,27 @@ public class Process { System.out.println("== phase "+phase+" =================================================================="); ctx2 = new Context(fp.getFleet()); proc.reset(ctx2, phase); + + final Semaphore sem = new Semaphore(0); + final FleetProcess fpf = fp; + final int phasef = phase; + new Thread() { + public void run() { + for(int ii=0; ii " + (ii+1) + " / " + reset_count); + fpf.recvWord(); + } + sem.release(); + }}.start(); + for(Dock dock : torpedoes) fp.sendToken(dock.getInstructionDestination()); ctx2.emit(ai = new ArrayList()); for(Instruction ins : ai) fp.sendInstruction(ins); fp.flush(); + + sem.acquire(); System.out.println("flushed"); - for(int ii=0; ii " + (ii+1) + " / " + reset_count); - fp.recvWord(); - } + System.out.println(); }