1700449659
1700449660
public final void stop(){
1700449661
1700449662
if((threadStatus!=0)&&!isAlive()){
1700449663
1700449664
return;
1700449665
1700449666
}
1700449667
1700449668
stop1(new ThreadDeath());
1700449669
1700449670
}
1700449671
1700449672
private final synchronized void stop1(Throwable th){
1700449673
1700449674
/*安全检查省略*/
1700449675
1700449676
if(threadStatus!=0){
1700449677
1700449678
resume();
1700449679
1700449680
stop0(th);
1700449681
1700449682
}else{
1700449683
1700449684
if(th==null){
1700449685
1700449686
throw new NullPointerException();
1700449687
1700449688
}
1700449689
1700449690
stopBeforeStart=true;
1700449691
1700449692
throwableFromStop=th;
1700449693
1700449694
}
1700449695
1700449696
这里设置了stopBeforeStart变量,标志着是在启动前设置了停止标志,在start方法中是这样校验的:
1700449697
1700449698
public synchronized void start(){
1700449699
1700449700
//分配栈内存,启动线程,运行run方法
1700449701
1700449702
start0();
1700449703
1700449704
//在启动前设置了停止状态
1700449705
1700449706
if(stopBeforeStart){
1700449707
1700449708
stop0(throwableFromStop);
[
上一页 ]
[ :1.700449659e+09 ]
[
下一页 ]