Skip to content

Commit f4c33d1

Browse files
authored
Update 线程状态转换以及基本操作.md
修改格式
1 parent 97178a8 commit f4c33d1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

2.线程的状态转换以及基本操作/线程状态转换以及基本操作.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ Thread类除了提供join()方法外,另外还提供了超时等待的方法
144144

145145
可以看出来当前等待对象threadA会一直阻塞,直到被等待对象threadB结束后即isAlive()返回false的时候才会结束while循环,当threadB退出时会调用notifyAll()方法通知所有的等待线程。下面用一个具体的例子来说说join方法的使用:
146146

147-
public class JoinDemo {
148-
public static void main(String[] args) throws InterruptedException {
147+
public class JoinDemo {
148+
public static void main(String[] args) throws InterruptedException {
149149
for (int i = 0; i <= 10; i++) {
150150
MyThread thread = new MyThread();
151151
thread.start();
@@ -159,7 +159,7 @@ public class JoinDemo {
159159
}
160160
}
161161

162-
static class MyThread extends Thread {
162+
static class MyThread extends Thread {
163163
@Override
164164
public void run() {
165165
try {

0 commit comments

Comments
 (0)