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

Method enterIf

output/java_guava/1.4.19/Monitor.java:628–642  ·  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. @return whether the monitor was entered, which guarantees that the guard is now satisfied

(Guard guard)

Source from the content-addressed store, hash-verified

626
627
628 public boolean enterIf(Guard guard) {
629 if (guard.monitor != this) {
630 throw new IllegalMonitorStateException();
631 }
632 final ReentrantLock lock = this.lock;
633 lock.lock();
634 boolean satisfied = false;
635 try {
636 return satisfied = guard.isSatisfied();
637 } finally {
638 if (!satisfied) {
639 lock.unlock();
640 }
641 }
642 }
643
644 /**
645 * Enters this monitor if the guard is satisfied. Blocks indefinitely acquiring the lock, but does

Callers 2

startAsyncMethod · 0.45
stopAsyncMethod · 0.45

Calls 4

enterMethod · 0.95
lockMethod · 0.45
isSatisfiedMethod · 0.45
unlockMethod · 0.45

Tested by

no test coverage detected