moved yield examples from core-java-concurrency-advanced to core-java-concurrency-advanced-2
This commit is contained in:
@@ -14,7 +14,6 @@
|
||||
- [CyclicBarrier in Java](https://www.baeldung.com/java-cyclic-barrier)
|
||||
- [Guide to the Volatile Keyword in Java](https://www.baeldung.com/java-volatile)
|
||||
|
||||
- [Brief Introduction to Java Thread.yield()](https://www.baeldung.com/java-thread-yield)
|
||||
- [Print Even and Odd Numbers Using 2 Threads](https://www.baeldung.com/java-even-odd-numbers-with-2-threads)
|
||||
- [Java CyclicBarrier vs CountDownLatch](https://www.baeldung.com/java-cyclicbarrier-countdownlatch)
|
||||
- [Guide to the Fork/Join Framework in Java](https://www.baeldung.com/java-fork-join)
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.baeldung.concurrent.yield;
|
||||
|
||||
public class ThreadYield {
|
||||
public static void main(String[] args) {
|
||||
Runnable r = () -> {
|
||||
int counter = 0;
|
||||
while (counter < 2) {
|
||||
System.out.println(Thread.currentThread()
|
||||
.getName());
|
||||
counter++;
|
||||
Thread.yield();
|
||||
}
|
||||
};
|
||||
new Thread(r).start();
|
||||
new Thread(r).start();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user