コード例 #1
0
ファイル: GCTest2.java プロジェクト: sherckuith/jop
  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);
    }
  }
コード例 #2
0
ファイル: sound4.java プロジェクト: sherckuith/jop
  public static void tetris() {
    on = true;
    RtThread.sleepMs(4);
    on = false;
    RtThread.sleepMs(796);
    on = true;
    RtThread.sleepMs(4);
    on = false;
    RtThread.sleepMs(796);
    on = true;
    RtThread.sleepMs(4);
    on = false;
    RtThread.sleepMs(796);
    on = true;
    RtThread.sleepMs(4);
    on = false;
    RtThread.sleepMs(796);
    on = true;

    for (int i = 0; i < TUNE_LENGTH - 1; i++) {
      if (NOTES[i] == ON) {
        on = true;
      } else if (NOTES[i] == OFF) {
        on = false;
      } else if (NOTES[i] == DONE) {
        break;
      } else {
        value = NOTES[i];
      }
      RtThread.sleepMs(PAUSES[i]);
    }
  }
コード例 #3
0
ファイル: Two.java プロジェクト: arekinath/jop
  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);
    }
  }
コード例 #4
0
ファイル: sound4.java プロジェクト: sherckuith/jop
  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) ;
    }
  }