Hey guys,
First of all I should thank you once agian for helping me in the problems I posted in the past.
Here I am dealing with one confusion in threads and want help and appreciate it in advance if somebody assists.
When we call wait method on the object then only the lock of that Object is released(Khalid Mughal's one of the query)
Select the two correct answers.
a) A thread can hold more than one lock at a time.
b) Invoking wait() on a Thread object will relinquish all locks held by the thread.
c)Invoking wait() on an object whose lock is held by the current thread will relinquish the lock.
d)Invoking notify() on a object whose lock is held by the current thread will relinquish the lock.
e)Multiple threads can hold the same lock at the same time.
Answer a,c
I was doing the Master test from K&B book CD, one of the answer is:
When a thread is waiting as a result of wait(), it releases all the locks it holds. while option c above contradicts it.
Please help
Uzma
First of all I should thank you once agian for helping me in the problems I posted in the past.
Here I am dealing with one confusion in threads and want help and appreciate it in advance if somebody assists.
When we call wait method on the object then only the lock of that Object is released(Khalid Mughal's one of the query)
Select the two correct answers.
a) A thread can hold more than one lock at a time.
b) Invoking wait() on a Thread object will relinquish all locks held by the thread.
c)Invoking wait() on an object whose lock is held by the current thread will relinquish the lock.
d)Invoking notify() on a object whose lock is held by the current thread will relinquish the lock.
e)Multiple threads can hold the same lock at the same time.
Answer a,c
I was doing the Master test from K&B book CD, one of the answer is:
When a thread is waiting as a result of wait(), it releases all the locks it holds. while option c above contradicts it.
Please help
Uzma