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

Method enterIf

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

628
629
630 public boolean enterIf(Guard guard) {
631 if (guard.monitor != this) {
632 throw new IllegalMonitorStateException();
633 }
634 final ReentrantLock lock = this.lock;
635 lock.lock();
636 boolean satisfied = false;
637 try {
638 return satisfied = guard.isSatisfied();
639 } finally {
640 if (!satisfied) {
641 lock.unlock();
642 }
643 }
644 }
645
646 /**
647 * 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