Testing thread join testcase
authoradash <adash>
Fri, 18 Jan 2008 08:05:12 +0000 (08:05 +0000)
committeradash <adash>
Fri, 18 Jan 2008 08:05:12 +0000 (08:05 +0000)
Robust/src/Tests/Atomic5.java

index 6fa23a3462ffa0a1f245ea719e10e86bb1e9849a..c53d56747a9e68b3e6eac0a58d981216420184ce 100644 (file)
@@ -14,7 +14,7 @@ public class Atomic5 extends Thread {
                        at5 =  global new Atomic5[4];
                }
                atomic {
-                       for(int i = 0 ; i< 4; i++) {
+                       for(int i = 0; i < 4; i++) {
                                at5[i] = global new Atomic5();
                                at5[i].team = global new People[2];
                                at5[i].team[0] = global new People();
@@ -26,14 +26,14 @@ public class Atomic5 extends Thread {
                        }
                        b = at5[1].team[0].getAge();
                }
+               System.printInt(b);
                atomic {
                        age = global new Integer(70);
                        name = global new String("John Smith");
                        at5[1].team[1].name = name;
                        at5[1].team[1].age = age;
-                       c = at5[1].team[1].getAge();
+                       c = at5[1].team[0].getAge();
                }
-               System.printInt(b);
                System.printInt(c);
                System.printString("\n");
                System.printString("Starting\n");
@@ -43,6 +43,11 @@ public class Atomic5 extends Thread {
                        }
                        tmp.start(mid);
                }
+
+               for(int i = 0; i< 4; i++) {
+                       tmp.join();
+               }
+
                /*
                for(int i = 0 ; i< 4; i++) {
                        at5[i].start(mid);