2 |
void wait(int timeout)
-
The wait() method is part of the Object class, and hence available for every object.
-
This method simply causes the thread to wait until notified or until the timeout occurs.
-
timeout is an optional argument. If missing or zero, thread waits until notify/notifyall called
-
This method must be called from a synchronized method.
-
wait() will be called while thread owns lock associated with a particular object. wait() releases this lock (atomically i.e. safely)
|