Created
October 26, 2018 10:36
-
-
Save mayojava/acde56dce0333a4a9b9c10f5834b68f0 to your computer and use it in GitHub Desktop.
Check for coroutine cancellation
This file contains hidden or 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
| while (isActive) { | |
| // print a message twice a second | |
| if (System.currentTimeMillis() >= nextPrintTime) { | |
| println("I'm sleeping ${i++} ...") | |
| nextPrintTime += 500L | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment