Example #1
0
 public void g() {
   synchronized (syncObject) {
     for (int i = 0; i < 5; i++) {
       print("g()");
       Thread.yield();
     }
   }
 }
Example #2
0
 public void run() {
   try {
     while (!Thread.interrupted()) q.take().run(); // Run task with the current thread
   } catch (InterruptedException e) {
     // Acceptable way to exit
   }
   print("Finished DelayedTaskConsumer");
 }
Example #3
0
 public synchronized void f() {
   for (int i = 0; i < 5; i++) {
     print("f()");
     Thread.yield();
   }
 }