pauseNanos

suspend fun pauseNanos(initialPauseNanos: Long, reason: MergePolicy.OneMergeProgress.PauseReason, condition: () -> Boolean)

Pauses the calling thread for at least pauseNanos nanoseconds unless the merge is aborted or the external condition returns false, in which case control returns immediately.

The external condition is required so that other threads can terminate the pausing immediately, before pauseNanos expires. We can't rely on just Condition.awaitNanos alone because it can return due to spurious wakeups too.

Parameters

condition

The pause condition that should return false if immediate return from this method is needed. Other threads can wake up any sleeping thread by calling .wakeup, but it'd fall to sleep for the remainder of the requested time if this condition