• Post Reply Bookmark Topic Watch Topic
  • New Topic

join() method  RSS feed

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. I'm a new greenhorn here. Hello to everyone. I'm taking the JDK1.4 certification this Thursday. I was wondering if anyone could shed some light on something I've been pondering for a while. Why is it ok to call the join() method on a thread that hasn't been started yet? Does the call simply get ignored or what? Thank you very much. Gisselle.
 
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To get a good idea of what is going on, you should browse the source of the java.lang.Thread class.
In a nutshell, join() invokes join(0) which in turn invokes wait(0) while isAlive() returns true.
Basically, if the thread on which join() has been invoked has not been started yet, the call to join() should return immediately.
[ January 13, 2003: Message edited by: Valentin Crettaz ]
 
Gisselle Szaritsa
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot! That was very helpful!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!