Win a copy of Pragmatic AI this week in the Artificial Intelligence forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

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!