Last active
May 21, 2019 08:00
-
-
Save objcode/6c6896031fc3a9665b46d7e6e56c4385 to your computer and use it in GitHub Desktop.
Example version of cancelPreviosThenRun.
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
// see the complete implementation at | |
// https://gist.github.com/objcode/7ab4e7b1df8acd88696cb0ccecad16f7 | |
suspend fun cancelPreviousThenRun(block: suspend () -> T): T { | |
// If there is an activeTask, cancel it because it's result is no longer needed | |
activeTask?.cancelAndJoin() | |
// ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment