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;
      }
 }
 

你可能感兴趣的:(join的源码)