Kotlin 2 · Coroutines

Limit how long work can take

Cancel a block that takes too long.

val result = withTimeoutOrNull(1_000) { slowCall() }

Official Kotlin 2 documentation

More coroutines commands

All coroutines commands · Kotlin 2 cheatsheet

Was this page helpful?