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

Method enterWhen

output/java_guava/1.4.17/Monitor.java:453–471  ·  view source on GitHub ↗

Enters this monitor when the guard is satisfied. Blocks indefinitely, but may be interrupted. @throws InterruptedException if interrupted while waiting

(Guard guard)

Source from the content-addressed store, hash-verified

451
452
453 public void enterWhen(Guard guard) throws InterruptedException {
454 if (guard.monitor != this) {
455 throw new IllegalMonitorStateException();
456 }
457 final ReentrantLock lock = this.lock;
458 boolean signalBeforeWaiting = lock.isHeldByCurrentThread();
459 lock.lockInterruptibly();
460 boolean satisfied = false;
461 try {
462 if (!guard.isSatisfied()) {
463 await(guard, signalBeforeWaiting);
464 }
465 satisfied = true;
466 } finally {
467 if (!satisfied) {
468 leave();
469 }
470 }
471 }
472
473 /**
474 * Enters this monitor when the guard is satisfied. Blocks indefinitely.

Callers

nothing calls this directly

Calls 11

awaitMethod · 0.95
leaveMethod · 0.95
toSafeNanosMethod · 0.95
initNanoTimeMethod · 0.95
awaitNanosMethod · 0.95
remainingNanosMethod · 0.95
signalNextWaiterMethod · 0.95
lockInterruptiblyMethod · 0.45
isSatisfiedMethod · 0.45
tryLockMethod · 0.45
unlockMethod · 0.45

Tested by

no test coverage detected