Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Cancellation using withTimeout / withTimeoutOrNull
import kotlinx.coroutines.*
fun main() {
runBlocking {
withTimeout(1000L) {
repeat(50) { waitingTime ->
println("Job is waiting $waitingTime...")
delay(100L)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment