Last active
January 19, 2024 17:52
-
-
Save tdcolvin/c18ff7a435340db05f80f33419a2b364 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
// !!!!! DON'T DO THIS !!!!! | |
suspend fun countToAHundredBillion_unsafe() { | |
var count = 0L | |
// This suspend fun won't be cancelled if the coroutine | |
// that's running it gets cancelled, because it doesn't | |
// ever yield. | |
while(count < 100_000_000_000) { | |
count++ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment