This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes wait() release all locks? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "wait() release all locks?" Watch "wait() release all locks?" New topic
Author

wait() release all locks?

Byron Foo
Greenhorn

Joined: Jul 20, 2005
Posts: 4
one of KB mock Qs says -- The following statement is true:
When a thread is waiting as result of wait(), it release all the locks it holds.

Which is wrong according to Khalid A. Mughal's book -- "Note that the waiting thread does not relinquish any other object locks that it might hold, only that of the object on which the wait() method was invoked. "

Who is right? The thread release all or just one lock?

Thanks.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

I think just the object that it issues the wait in.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
GeeCON Prague 2014
 
subject: wait() release all locks?