Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Thread - join method  RSS feed

 
Cliff DeRose
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a SCJD exam review book, which tries to explain the join method you can call on a Thread instance. However, its a little confusing to me. Could someone please explain exactly how the join method works when you call it on a Thread instance.
Thanks,
Cliff
 
Ray Stojonic
Ranch Hand
Posts: 326
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Thread.join method will not return to the caller until: 1) the thread join was called on dies, or 2) the specified amount of time elapses.
try the following code, both as is and with the try:join block commented out to see this in action

[ January 12, 2004: Message edited by: Ray Stojonic ]
 
Cliff DeRose
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks so much. It is much easier to understand after seeing it in action.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!