Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
Answer: B does NOT re-enter the wait state, but neither does it own the lock on Obj, even though B's program counter is within a section of synchronized code and is runnable. The thread B blocks till it gets the monitor, and then resumes
To the best of my understanding, you're correct - B is no longer waiting (having been notified), but it can't run either. B is blocked while it contends for the object's lock. To be picky, I wouldn't actually call B's state "runnable". I like to consider "contending for lock" one of the possible states of a thread
Senior Software Engineer, IBM
author of: Practical Java
Senior Software Engineer, IBM
author of: Practical Java
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |