/**
加了同步的线程启动方法
**/
public synchronized void start() {
/**
* 新建的线程状态为 "NEW",此时状态属性threadStatus的值为0, .
*再次启动将会抛出 IllegalThreadStateException的异常
**/
if (threadStatus != 0 || this != me)
throw new IllegalThreadStateException();
group.add(this);
start0();
if (stopBeforeStart) {
stop0(throwableFromStop);
}
}
只能启动(start)一次的线程
翻译文章标签 线程 启动 start 文章分类 Java 后端开发
上一篇:线程的状态
下一篇:先后有序的wait和notify
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
python 判断for循环最后一次
本文简要介绍了Python 判断for循环最后一次的6种方法。
迭代 迭代器 python