jQuery in Action, 3rd edition
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

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "wait() release all locks?" Watch "wait() release all locks?" New topic

wait() release all locks?

Byron Foo

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?

Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

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


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
I agree. Here's the link: http://aspose.com/file-tools
subject: wait() release all locks?
It's not a secret anymore!