await

open suspend override fun await()

Implements interruptible condition wait.

  1. If current thread is interrupted, throw InterruptedException.

  2. Save lock state returned by .getState.

  3. Invoke .release with saved state as argument, throwing IllegalMonitorStateException if it fails.

  4. Block until signalled or interrupted.

  5. Reacquire by invoking specialized version of .acquire with saved state as argument.

  6. If interrupted while blocked in step 4, throw InterruptedException.


open suspend override fun await(time: Long, unit: TimeUnit): Boolean

Implements timed condition wait.

  1. If current thread is interrupted, throw InterruptedException.

  2. Save lock state returned by .getState.

  3. Invoke .release with saved state as argument, throwing IllegalMonitorStateException if it fails.

  4. Block until signalled, interrupted, or timed out.

  5. Reacquire by invoking specialized version of .acquire with saved state as argument.

  6. If interrupted while blocked in step 4, throw InterruptedException.

  7. If timed out while blocked in step 4, return false, else true.