join的源码

 long base = System.currentTimeMills();
 long now = 0;

 if(millis < 0){
 throw new IllegalArgumentException("timeout value is negative");

 }
 if(millis == 0){
      while(isAlive()){
      wait(0);
      }
 }else{
      while(isAlive()){
           long delay = millis-now;
           if(delay <= 0){
               break;
           }
           wait(delay);
           now  = System.currentTimeMillis()-base;
      }
 }
 

posted @ 2019-06-10 18:39  那些年的代码  阅读(255)  评论(0编辑  收藏  举报