• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

use of join() and yeild() method

 
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the significance of the join and yeild methods in the threads?how and when are they used?
 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
join() allows you to wait until one thread is done before another can continue. So, let's assume that Thread object test1 is the current thread of execution. If the following code is executed:

...The test1 will have to wait until test2 is dead before it can continue running.
yeild(), theoretically, allows you to force the current thread of execution to take a break while a thread of equal importance is given a chance to run. I've heard that this isn't the most reliable method in the world, but others may disagree.
[ May 06, 2003: Message edited by: Tom Purl ]
[ May 06, 2003: Message edited by: Tom Purl ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic