• Post Reply Bookmark Topic Watch Topic
  • New Topic

What happens if we call join(), before start()?

 
Vadim Vararu
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happens if we call newThread.join(), before newThread.start(), let's say, in main method (thread)? I didn't see any effects...
 
Henry Wong
author
Sheriff
Posts: 22532
109
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nothing. The method just returns... which you have seen.

Henry
 
Ajay Saxena
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Following is the implementation of Thread.join(long millis). Calling newThread.join() leads to join(0) being called which in turn,as Henry said,causes the method to return,because isAlive() for a thread that has not been started would return false.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!