The moose likes Threads and Synchronization and the fly likes use of join()  and yeild() method Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Reply Bookmark "use of join()  and yeild() method" Watch "use of join()  and yeild() method" New topic
Author

use of join() and yeild() method

william kane
Ranch Hand

Joined: Nov 21, 2000
Posts: 260
What is the significance of the join and yeild methods in the threads?how and when are they used?


Help me!Help you!!!
Tom Purl
Ranch Hand

Joined: May 24, 2002
Posts: 104
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 ]

Tom Purl<br />SCJP 1.4
 
 
subject: use of join() and yeild() method
 
Threads others viewed
Here i am again with if/else statement now
Regarding locks
SCJWSD online Group study
join() ?
Which method names are overloaded?
MyEclipse, The Clear Choice