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

Method enterIfInterruptibly

output/java_guava/1.4.16/Monitor.java:655–669  ·  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

653
654
655 public boolean enterIfInterruptibly(Guard guard) throws InterruptedException {
656 if (guard.monitor != this) {
657 throw new IllegalMonitorStateException();
658 }
659 final ReentrantLock lock = this.lock;
660 lock.lockInterruptibly();
661 boolean satisfied = false;
662 try {
663 return satisfied = guard.isSatisfied();
664 } finally {
665 if (!satisfied) {
666 lock.unlock();
667 }
668 }
669 }
670
671 /**
672 * 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