public void waitFor ( Guard guard ) throws InterruptedException { if ( ! ( ( guard . monitor == this ) & lock . isHeldByCurrentThread ( ) ) ) { throw new IllegalMonitorStateException ( ) ; } if ( ! guard . isSatisfied ( ) ) { await ( guard , true ) ; } }
Waits for the guard to be satisfied . Waits indefinitely but may be interrupted . May be called only by a thread currently occupying this monitor .