@@ -1,8 +1,8 @@
public class Main {
public static void main (String argv[]) {
Thread t1, t2;
- t1 = new DispTask();
- t2 = new DispTask();
+ t1 = new DispTask(false);
+ t2 = new DispTask(false);
t1.start();
t2.start();
@@ -1,8 +1,16 @@
class DispTask extends Thread {
+ boolean doYield;
+
+ DispTask(boolean _doYield) {
+ doYield = _doYield;
+ }
public void run() {
for (int i = 0; i < 10; i++) {
System.out.println(i);
- // yield();
+ if (doYield)
+ yield();
}