Skip to content

Instantly share code, notes, and snippets.

@aleksandarzekovic
Created August 13, 2022 19:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aleksandarzekovic/8f44a2bcf2ba3bbe78dd8671f9c0aa34 to your computer and use it in GitHub Desktop.
Save aleksandarzekovic/8f44a2bcf2ba3bbe78dd8671f9c0aa34 to your computer and use it in GitHub Desktop.
@InternalCoroutinesApi
public operator fun <T> invoke(block: suspend () -> T, completion: Continuation<T>): Unit =
when (this) {
DEFAULT -> block.startCoroutineCancellable(completion)
ATOMIC -> block.startCoroutine(completion)
UNDISPATCHED -> block.startCoroutineUndispatched(completion)
LAZY -> Unit // will start lazily
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment