Results 1 to 3 of 3
- 12-25-2008, 07:42 AM #1
Member
- Join Date
- Dec 2008
- Posts
- 5
- Rep Power
- 0
- 12-25-2008, 05:12 PM #2
Senior Member
- Join Date
- Nov 2008
- Posts
- 286
- Rep Power
- 5
No. Calling yield() relinquishes the CPU but, like sleep(), holds on to any synchronization locks. This is different to wait(), which does relinquish the lock on the object being waited on (but only that object).
I've written up some more detailed information on what Thread.yield() does on different systems/VM versions in case you're interested.Neil Coffey
Javamex - Java tutorials and performance info
- 12-04-2012, 05:35 PM #3
Re: calling yield() method in synchronized block
Thread has a state RUNNABLE that means that this thread is eligible from the scheduler to run and change the state from RUNNABLE to RUNNING. Using yield() on a thread the thread change his state from RUNNING to RUNNABLE. But if all threads has the same priority the same thread my return to the RUNNING state so that yield() has no effect at all.
Similar Threads
-
[SOLVED] Non-synchronized instance method of an Object
By piyu.sha in forum Threads and SynchronizationReplies: 2Last Post: 10-06-2008, 06:35 AM -
Calling a method in a different class from within a method problem
By CirKuT in forum New To JavaReplies: 29Last Post: 09-25-2008, 07:55 PM -
method calling?
By frejon26 in forum New To JavaReplies: 4Last Post: 01-25-2008, 03:38 AM -
Return in the Middle of synchronized Block
By ariak in forum Advanced JavaReplies: 1Last Post: 07-26-2007, 10:24 AM -
Help with Calling a method
By Albert in forum New To JavaReplies: 3Last Post: 07-10-2007, 03:27 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks