CountDownLatch

class CountDownLatch(initial: Long)

CountDownLatch allows for awaiting a given number of countdown signals. Models the behavior of java.util.concurrent.CountDownLatch in Kotlin with suspend.

Must be initialised with an initial value of 1 or higher, if constructed with 0 or negative value then it throws IllegalArgumentException.

Constructors

Link copied to clipboard
constructor(initial: Long)

Functions

Link copied to clipboard
suspend fun await()

Await count to reach zero

Link copied to clipboard
fun count(): Long

Remaining count

Link copied to clipboard
fun countDown()

Decrement count by one