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
Destiny's powerful hand has made the bed of my future. And this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|