This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I think the second is correct, the notified thread has to wait for the lock being released. And notify() will not release the key, the thread calling notify has to leave the sync block first. If he's the one having that lock.
Api says about this: java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#notify() Second paragraph: "The awakened thread will not be able to proceed until the current thread relinquishes the lock on this object."
all events occur in real time
Joined: Jul 31, 2006
thats what i thought but in one of the mock exams ive encountered a question stating " when will the thread enters the runnable state and the answer given is "when notify() is called". Im doubtful if this is an absolute answer.