Type a guarded block that waits in a while loop
Type a guarded block that waits in a while loop
Answer
synchronized (lock) { while (!ready) { lock.wait(); } }
wait() releases the monitor and parks until notified; the while loop re-checks the condition to guard against spurious wakeups and stale state.