I know what wait()
and notify()
does. But I am slightly confused by a part of definition of notify()
method that I find most at the places.
Here is definition given for notify()
method:
For all threads waiting on this object's monitor (by using any one of the wait() method), the method notify() notifies any one of them to wake up arbitrarily.
I was confused with the part waiting on this object's monitor.
Question : When we call obj.wait() method. Current thread releases the monitor lock. So my current thread is now not waiting on object's monitor. It is just in waiting state. As I know what does it mean by waiting state, It acknowledges Operating system to put the thread into sleep state and It keeps information of such threads into somewhere with Object(I am not sure where It stores information) So don't you think,
It is just in waiting state. not waiting on object's monitor.
I appreciate if you can help me with my understanding.