Package avrora.sim

Examples of avrora.sim.SimulatorThread


  public synchronized void start(){
    Utils.debugMsg("Aufruf start()", this);
    Iterator threadIterator = threadMap.keySet().iterator();
    boolean first = true;
    while (threadIterator.hasNext()){
      SimulatorThread thread = (SimulatorThread)threadIterator.next();
      if (first) { // activate random thread
        ((SyncEvent)threadMap.get(thread)).activate = true;
        first = false;
      }
      thread.getSimulator().insertWatch(watch, Const.SHARED_MEM_SEND_ADDRESS);
      thread.start();
    } // while
  } // start
View Full Code Here


   * e.g. because of the termination of a thread, a
   * <code>ConcurrentModificationException</code> was thrown.
   */
  public void join() throws java.lang.InterruptedException {
    Utils.debugMsg("Aufruf join()", this);
    SimulatorThread thread;

    do {
      // Damit zwischendurch niemand die threadMap veraendert
      synchronized (this) {
        if (! threadMap.keySet().isEmpty()) {
          thread = (SimulatorThread) threadMap.keySet().toArray()[0];
        } else {
          thread = null;
        }
      }

      // Der folgende Teil darf nicht im synchronized-Block enthalten sein,
      // da er sonst andere Teile des Programms blockieren wuerde
      if (thread != null)
        thread.join();
    } while (! threadMap.keySet().isEmpty());
  } // join
View Full Code Here

   */
  public synchronized void stop() {
    Utils.debugMsg("Aufruf stop()", this);
    Iterator threadIterator = threadMap.keySet().iterator();
    while (threadIterator.hasNext()) {
      SimulatorThread thread = (SimulatorThread)threadIterator.next();
      thread.getSimulator().stop();
    }
  } // stop
View Full Code Here

   @see extern.Const.SIG_NODE_TRANSITION_FINISHED
   *  @see extern.Const.SIG_NODE_RECEIVE_DATA_FINISHED
   */
  public void resetEventToNow(Simulator sim, byte sigCode){
    Utils.debugMsg("resetEventToNow()", this);
    SimulatorThread thread = (SimulatorThread) simMap.get(sim);
    if (thread == null) {
      System.err.println("Thread is no longer available");
      System.exit(1);
    }
    SyncEvent event = (SyncEvent) threadMap.get(thread);
View Full Code Here

    if (tmpNode == null) {
      System.err.println("SimInput: Versuch, nicht vorhandenen Knoten aufzurufen, ID=\""+nodeId+"\"");
      System.exit(1);
    }

    SimulatorThread thread = tmpNode.getThread();

    if (thread == null) { // Das hier auch noch an Node anpassen, sonst NullPointer vorher moeglich
      System.err.println("Ungueltige ID uebergeben bekommen: "+nodeId);
      System.exit(1);
    }
View Full Code Here

            }
            Utils.debugMsg("Thread "+thread.hashCode()+" fragt naechsten Thread ab", this);

            this.activate = false;
            ThreadTime next = timing.getNextThread();
            SimulatorThread st = next.getSimulatorThread();
            long time = next.getTime();
     
            if (time == 0 && st == null) {
              terminateSim = true;
              condition.notifyAll();
View Full Code Here

        System.err.println("I/O-Exception:");
        System.err.println(e);
        System.exit(1);
      } // try-catch

      SimulatorThread thread = ((Simulation.Node)nodes.get(new Integer(nodeId))).getThread();
      //SimulatorThread thread = (SimulatorThread)threads.get(new Integer(threadId));
      if (thread == null) { // Das hier auch noch an Node anpassen, sonst NullPointer vorher moeglich
        System.err.println("Ungueltige ID eingegeben: "+threadId);
        System.exit(1);
      }
View Full Code Here

TOP

Related Classes of avrora.sim.SimulatorThread

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.