java - What happens when wait() is called on an object not extending Thread or implements Runnable? -
what happens when wait() called on object not extending thread or implements runnable?
this such simple question when asked had ok not exact answer. exact answers?
the java docs pretty clear on this. names suggest, causes current thread wait until notify or notifyall called on object (by thread). these methods used coordinate between threads need access same critical resources , need mutual exclusion. in depth discussion here.
calling wait , notify on thread object makes sense if thread being used lock object, unusual in experience.
Comments
Post a Comment