MCPcopy Create free account
hub / github.com/antlr/codebuff / enterIfInterruptibly

Method enterIfInterruptibly

output/java_guava/1.4.19/Monitor.java:653–667  ·  view source on GitHub ↗

Enters this monitor if the guard is satisfied. Blocks indefinitely acquiring the lock, but does not wait for the guard to be satisfied, and may be interrupted. @return whether the monitor was entered, which guarantees that the guard is now satisfied @throws InterruptedException if interrupted while

(Guard guard)

Source from the content-addressed store, hash-verified

651
652
653 public boolean enterIfInterruptibly(Guard guard) throws InterruptedException {
654 if (guard.monitor != this) {
655 throw new IllegalMonitorStateException();
656 }
657 final ReentrantLock lock = this.lock;
658 lock.lockInterruptibly();
659 boolean satisfied = false;
660 try {
661 return satisfied = guard.isSatisfied();
662 } finally {
663 if (!satisfied) {
664 lock.unlock();
665 }
666 }
667 }
668
669 /**
670 * Enters this monitor if the guard is satisfied. Blocks at most the given time acquiring the

Callers

nothing calls this directly

Calls 4

lockInterruptiblyMethod · 0.45
isSatisfiedMethod · 0.45
unlockMethod · 0.45
tryLockMethod · 0.45

Tested by

no test coverage detected