Last active
September 12, 2022 08:47
-
-
Save aleksandarzekovic/2c6b6991895e144d07bba3fbd0d9dc16 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
/** | |
* param completion is AbstractCoroutine | |
* return a Continuation | |
*/ | |
internal fun <R , T> (suspend ( R ) -> T).startCoroutineCancellable(receiver: R, completion: Continuation<T>) = | |
runSafely(completion) { | |
createCoroutineUnintercepted(receiver, completion).intercepted().resumeCancellableWith(Result.success(Unit)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment