标签:
1 package TestThread; 2 3 /** 4 * 子线程循环 10 次, 接着主线程循环 100, 接着又回到子线程循环 10 次, 接着再回到主线程又循环 100, 如此循环 50 次 5 * 6 * @author trfizeng 7 * 8 */ 9 public class ThreadTest { 10 static int round = 1; 11 12 public static void main(String[] args) { 13 ThreadTest threadTest = new ThreadTest(); 14 15 Thread mainT = new Thread(threadTest.new mainT()); 16 mainT.setName("mainT Thread "); 17 18 Thread subT = new Thread(threadTest.new subT()); 19 subT.setName("subT Thread "); 20 21 subT.start(); 22 mainT.start(); 23 } 24 25 class mainT implements Runnable { 26 public void run() { 27 // 主线程 28 synchronized (mainT.class) { 29 while (round <= 50) { 30 System.out.println("The sequence of the " + round 31 + " round"); 32 System.out.println(Thread.currentThread().getName() 33 + " enter "); 34 System.out.print(Thread.currentThread().getName() 35 + " run: "); 36 for (int i = 1; i <= 100; i++) { 37 System.out.print(i + " "); 38 } 39 System.out.println("\n" + Thread.currentThread().getName() 40 + " notify sub thread"); 41 round++; 42 mainT.class.notify(); 43 try { 44 System.out.println(Thread.currentThread().getName() 45 + " wait"); 46 mainT.class.wait(); 47 } catch (InterruptedException e) { 48 e.printStackTrace(); 49 } 50 System.out.println(Thread.currentThread().getName() 51 + " out"); 52 } 53 } 54 } 55 } 56 57 class subT implements Runnable { 58 public void run() { 59 // 子线程 60 synchronized (mainT.class) { 61 while (round <= 50) { 62 System.out.println("The sequence of the " + round 63 + " round"); 64 System.out.println(Thread.currentThread().getName() 65 + " enter"); 66 System.out.print(Thread.currentThread().getName() 67 + " run: "); 68 for (int i = 1; i <= 10; i++) { 69 System.out.print(i + " "); 70 } 71 try { 72 System.out.println("\n" 73 + Thread.currentThread().getName() 74 + " waiting "); 75 round++; 76 mainT.class.wait(); 77 System.out.println(Thread.currentThread().getName() 78 + " notify main thread"); 79 mainT.class.notify(); 80 } catch (InterruptedException e) { 81 e.printStackTrace(); 82 } 83 System.out.println(Thread.currentThread().getName() 84 + " out \n"); 85 } 86 } 87 } 88 } 89 90 }
The sequence of the 1 round
subT Thread enter
subT Thread run: 1 2 3 4 5 6 7 8 9 10
subT Thread waiting
The sequence of the 2 round
mainT Thread enter
mainT Thread run: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Thread out
The sequence of the 3 round
subT Thread enter
subT Thread run: 1 2 3 4 5 6 7 8 9 10
subT Thread waiting
mainT Thread out
The sequence of the 4 round
mainT Thread enter
mainT Thread run: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Thread out
The sequence of the 5 round
subT Thread enter
subT Thread run: 1 2 3 4 5 6 7 8 9 10
subT Thread waiting
mainT Thread out
The sequence of the 6 round
mainT Thread enter
mainT Thread run: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Thread out
The sequence of the 7 round
subT Thread enter
subT Thread run: 1 2 3 4 5 6 7 8 9 10
subT Thread waiting
mainT Thread out
The sequence of the 8 round
mainT Thread enter
mainT Thread run: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Thread out
The sequence of the 9 round
subT Thread enter
subT Thread run: 1 2 3 4 5 6 7 8 9 10
subT Thread waiting
mainT Thread out
The sequence of the 10 round
mainT Thread enter
mainT Thread run: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Thread out
The sequence of the 11 round
subT Thread enter
subT Thread run: 1 2 3 4 5 6 7 8 9 10
subT Thread waiting
mainT Thread out
The sequence of the 12 round
mainT Thread enter
mainT Thread run: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Thread out
The sequence of the 13 round
subT Thread enter
subT Thread run: 1 2 3 4 5 6 7 8 9 10
subT Thread waiting
mainT Thread out
The sequence of the 14 round
mainT Thread enter
mainT Thread run: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Thread out
The sequence of the 15 round
subT Thread enter
subT Thread run: 1 2 3 4 5 6 7 8 9 10
subT Thread waiting
mainT Thread out
The sequence of the 16 round
mainT Thread enter
mainT Thread run: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Thread out
The sequence of the 17 round
subT Thread enter
subT Thread run: 1 2 3 4 5 6 7 8 9 10
subT Thread waiting
mainT Thread out
The sequence of the 18 round
mainT Thread enter
mainT Thread run: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Thread out
The sequence of the 19 round
subT Thread enter
subT Thread run: 1 2 3 4 5 6 7 8 9 10
subT Thread waiting
mainT Thread out
The sequence of the 20 round
mainT Thread enter
mainT Thread run: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Thread out
The sequence of the 21 round
subT Thread enter
subT Thread run: 1 2 3 4 5 6 7 8 9 10
subT Thread waiting
mainT Thread out
The sequence of the 22 round
mainT Thread enter
mainT Thread run: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Thread out
The sequence of the 23 round
subT Thread enter
subT Thread run: 1 2 3 4 5 6 7 8 9 10
subT Thread waiting
mainT Thread out
The sequence of the 24 round
mainT Thread enter
mainT Thread run: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Thread out
The sequence of the 25 round
subT Thread enter
subT Thread run: 1 2 3 4 5 6 7 8 9 10
subT Thread waiting
mainT Thread out
The sequence of the 26 round
mainT Thread enter
mainT Thread run: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Thread out
The sequence of the 27 round
subT Thread enter
subT Thread run: 1 2 3 4 5 6 7 8 9 10
subT Thread waiting
mainT Thread out
The sequence of the 28 round
mainT Thread enter
mainT Thread run: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Thread out
The sequence of the 29 round
subT Thread enter
subT Thread run: 1 2 3 4 5 6 7 8 9 10
subT Thread waiting
mainT Thread out
The sequence of the 30 round
mainT Thread enter
mainT Thread run: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Thread out
The sequence of the 31 round
subT Thread enter
subT Thread run: 1 2 3 4 5 6 7 8 9 10
subT Thread waiting
mainT Thread out
The sequence of the 32 round
mainT Thread enter
mainT Thread run: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Thread out
The sequence of the 33 round
subT Thread enter
subT Thread run: 1 2 3 4 5 6 7 8 9 10
subT Thread waiting
mainT Thread out
The sequence of the 34 round
mainT Thread enter
mainT Thread run: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Thread out
The sequence of the 35 round
subT Thread enter
subT Thread run: 1 2 3 4 5 6 7 8 9 10
subT Thread waiting
mainT Thread out
The sequence of the 36 round
mainT Thread enter
mainT Thread run: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Thread out
The sequence of the 37 round
subT Thread enter
subT Thread run: 1 2 3 4 5 6 7 8 9 10
subT Thread waiting
mainT Thread out
The sequence of the 38 round
mainT Thread enter
mainT Thread run: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Thread out
The sequence of the 39 round
subT Thread enter
subT Thread run: 1 2 3 4 5 6 7 8 9 10
subT Thread waiting
mainT Thread out
The sequence of the 40 round
mainT Thread enter
mainT Thread run: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Thread out
The sequence of the 41 round
subT Thread enter
subT Thread run: 1 2 3 4 5 6 7 8 9 10
subT Thread waiting
mainT Thread out
The sequence of the 42 round
mainT Thread enter
mainT Thread run: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Thread out
The sequence of the 43 round
subT Thread enter
subT Thread run: 1 2 3 4 5 6 7 8 9 10
subT Thread waiting
mainT Thread out
The sequence of the 44 round
mainT Thread enter
mainT Thread run: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Thread out
The sequence of the 45 round
subT Thread enter
subT Thread run: 1 2 3 4 5 6 7 8 9 10
subT Thread waiting
mainT Thread out
The sequence of the 46 round
mainT Thread enter
mainT Thread run: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Thread out
The sequence of the 47 round
subT Thread enter
subT Thread run: 1 2 3 4 5 6 7 8 9 10
subT Thread waiting
mainT Thread out
The sequence of the 48 round
mainT Thread enter
mainT Thread run: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Thread out
The sequence of the 49 round
subT Thread enter
subT Thread run: 1 2 3 4 5 6 7 8 9 10
subT Thread waiting
mainT Thread out
The sequence of the 50 round
mainT Thread enter
mainT Thread run: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Thread out
mainT Thread out
The sequence of the 1 round
subT Thread enter
subT Thread run:12345678910
subT Thread waiting
The sequence of the 2 round
mainT Thread enter
mainT Thread run:123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Threadout
The sequence of the 3 round
subT Thread enter
subT Thread run:12345678910
subT Thread waiting
mainT Threadout
The sequence of the 4 round
mainT Thread enter
mainT Thread run:123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Threadout
The sequence of the 5 round
subT Thread enter
subT Thread run:12345678910
subT Thread waiting
mainT Threadout
The sequence of the 6 round
mainT Thread enter
mainT Thread run:123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Threadout
The sequence of the 7 round
subT Thread enter
subT Thread run:12345678910
subT Thread waiting
mainT Threadout
The sequence of the 8 round
mainT Thread enter
mainT Thread run:123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Threadout
The sequence of the 9 round
subT Thread enter
subT Thread run:12345678910
subT Thread waiting
mainT Threadout
The sequence of the 10 round
mainT Thread enter
mainT Thread run:123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Threadout
The sequence of the 11 round
subT Thread enter
subT Thread run:12345678910
subT Thread waiting
mainT Threadout
The sequence of the 12 round
mainT Thread enter
mainT Thread run:123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Threadout
The sequence of the 13 round
subT Thread enter
subT Thread run:12345678910
subT Thread waiting
mainT Threadout
The sequence of the 14 round
mainT Thread enter
mainT Thread run:123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Threadout
The sequence of the 15 round
subT Thread enter
subT Thread run:12345678910
subT Thread waiting
mainT Threadout
The sequence of the 16 round
mainT Thread enter
mainT Thread run:123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Threadout
The sequence of the 17 round
subT Thread enter
subT Thread run:12345678910
subT Thread waiting
mainT Threadout
The sequence of the 18 round
mainT Thread enter
mainT Thread run:123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Threadout
The sequence of the 19 round
subT Thread enter
subT Thread run:12345678910
subT Thread waiting
mainT Threadout
The sequence of the 20 round
mainT Thread enter
mainT Thread run:123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Threadout
The sequence of the 21 round
subT Thread enter
subT Thread run:12345678910
subT Thread waiting
mainT Threadout
The sequence of the 22 round
mainT Thread enter
mainT Thread run:123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Threadout
The sequence of the 23 round
subT Thread enter
subT Thread run:12345678910
subT Thread waiting
mainT Threadout
The sequence of the 24 round
mainT Thread enter
mainT Thread run:123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Threadout
The sequence of the 25 round
subT Thread enter
subT Thread run:12345678910
subT Thread waiting
mainT Threadout
The sequence of the 26 round
mainT Thread enter
mainT Thread run:123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Threadout
The sequence of the 27 round
subT Thread enter
subT Thread run:12345678910
subT Thread waiting
mainT Threadout
The sequence of the 28 round
mainT Thread enter
mainT Thread run:123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Threadout
The sequence of the 29 round
subT Thread enter
subT Thread run:12345678910
subT Thread waiting
mainT Threadout
The sequence of the 30 round
mainT Thread enter
mainT Thread run:123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Threadout
The sequence of the 31 round
subT Thread enter
subT Thread run:12345678910
subT Thread waiting
mainT Threadout
The sequence of the 32 round
mainT Thread enter
mainT Thread run:123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Threadout
The sequence of the 33 round
subT Thread enter
subT Thread run:12345678910
subT Thread waiting
mainT Threadout
The sequence of the 34 round
mainT Thread enter
mainT Thread run:123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Threadout
The sequence of the 35 round
subT Thread enter
subT Thread run:12345678910
subT Thread waiting
mainT Threadout
The sequence of the 36 round
mainT Thread enter
mainT Thread run:123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Threadout
The sequence of the 37 round
subT Thread enter
subT Thread run:12345678910
subT Thread waiting
mainT Threadout
The sequence of the 38 round
mainT Thread enter
mainT Thread run:123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Threadout
The sequence of the 39 round
subT Thread enter
subT Thread run:12345678910
subT Thread waiting
mainT Threadout
The sequence of the 40 round
mainT Thread enter
mainT Thread run:123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Threadout
The sequence of the 41 round
subT Thread enter
subT Thread run:12345678910
subT Thread waiting
mainT Threadout
The sequence of the 42 round
mainT Thread enter
mainT Thread run:123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Threadout
The sequence of the 43 round
subT Thread enter
subT Thread run:12345678910
subT Thread waiting
mainT Threadout
The sequence of the 44 round
mainT Thread enter
mainT Thread run:123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Threadout
The sequence of the 45 round
subT Thread enter
subT Thread run:12345678910
subT Thread waiting
mainT Threadout
The sequence of the 46 round
mainT Thread enter
mainT Thread run:123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Threadout
The sequence of the 47 round
subT Thread enter
subT Thread run:12345678910
subT Thread waiting
mainT Threadout
The sequence of the 48 round
mainT Thread enter
mainT Thread run:123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Threadout
The sequence of the 49 round
subT Thread enter
subT Thread run:12345678910
subT Thread waiting
mainT Threadout
The sequence of the 50 round
mainT Thread enter
mainT Thread run:123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
mainT Thread notify sub thread
mainT Thread wait
subT Thread notify main thread
subT Threadout
mainT Threadout
子线程循环 10 次,接着主线程循环 100,接着又回到子线程循环 10 次, 接着再回到主线程又循环 100,如此循环 50 次
标签:
原文地址:http://www.cnblogs.com/trfizeng/p/4307698.html