Created
January 30, 2021 17:28
-
-
Save GauravChaddha1996/daebf63174a91e70d1b3394d013fdd65 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
withTimeout(1000) { | |
repeat(100) { i -> | |
println("I'm sleeping $i ...") | |
delay(500L) | |
} | |
} | |
Output: | |
I'm sleeping 0 ... | |
I'm sleeping 1 ... | |
Exception in thread "main" | |
kotlinx.coroutines.TimeoutCancellationException: Timed out | |
waiting for 1000 ms |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment