Exemplo n.º 1
0
  public static void main(String s[]) {
    NUMTHREADS = 500; // Takes about 2 min to run.
    System.out.print("NUMTHREADS ");
    System.out.println(NUMTHREADS);
    garbageThreads = new GarbageThread[NUMTHREADS];
    System.out.println("gabagethreads length " + garbageThreads.length);

    for (int i = 0; i < NUMTHREADS; i++) {
      GarbageThread gt = new GarbageThread(i + 10, (i + 1) * 100000, i, NUMTHREADS, garbageThreads);
      garbageThreads[i] = gt;
    }
    System.out.println("Threads created");

    int gcBefore = GC.freeMemory();
    Garbage2 garbage = new Garbage2();
    garbage.size = gcBefore - GC.freeMemory();
    System.out.println("here2");
    // Give the garbage object to the first thread

    garbageThreads[0].garbage = garbage;
    System.out.println("here3");
    garbage = null;
    System.out.println("here2");
    RtThread.startMission();
    System.out.println("startMission called");
    for (; ; ) {
      System.out.println("Sleeping for 1000 ms");
      RtThread.sleepMs(1000);
    }
  }
Exemplo n.º 2
0
  public static void main(String[] args) {

    Dbg.initSer(); // use serial line for debug output

    new Two('a');
    new Two('b');
    new Two('c');

    RtThread.startMission();

    // sleep
    for (; ; ) {
      Dbg.wr('M');
      Timer.wd();
      RtThread.sleepMs(1200);
    }
  }
Exemplo n.º 3
0
  public static void main(String[] agrgs) {
    System.out.println("Initializing...");

    init();

    new RtThread(10, 100) {
      public void run() {
        for (; ; ) {
          loop();
          waitForNextPeriod();
        }
      }
    };

    RtThread.startMission();

    while (true) {
      on = true;
      tetris();
      while (Buttons.getButtons() == 0) ;
      while (Buttons.getButtons() != 0) ;
    }
  }