Just joined last night and successfully logged in here, ...ning.com following the link above led to a request to relogin and its not working. Not much of an issue yet....but thought I'd pass it on.
Thanks for the quick reply. Maybe I was not very explicit in my message. I am made to understand that lock.lock behaves exactly the same as synchronized on the lock object. which means if synchronized acquires the object monitor, so does…"
"Welcome to a slightly confusing feature of Locks.
If you use one of the explicit Lock classes such as ReentrantLock, then the method you call is called await()-- notice the "a" at the beginning-- rather than the wait() method (which still…"
The thread calling synchronzed(obj) acquires and owns that objects monitor till it releases it. Does lock.lock also behaves in a similar fashion. I tried calling lock.wait() after lock.lock() using an instance of ReentrantLock and the code gave me IllegalMonitorStateException.See More
"I ran this in Solaris. When the waiting dead lock happens, press ctl+\. (SIGQUIT, 3). On Windows, try ctl + break.
This problem may result if the program creates say 5 producers and 1 consumer, and each can wake up just one other thread,…"
Good explaination. This is certainly not the deadlock scenario we generally talk about.
By the way, how did you produce the thread trace which shows very clearly the state of each thread.