Skip to content

Instantly share code, notes, and snippets.

@RBusarow
Last active July 13, 2019 21:01
Show Gist options
  • Save RBusarow/2f6bbf1df696b3cff452846d24179ba0 to your computer and use it in GitHub Desktop.
Save RBusarow/2f6bbf1df696b3cff452846d24179ba0 to your computer and use it in GitHub Desktop.
class SomeCoroutineScopeClass : CoroutineScope {
override val coroutineContext: CoroutineContext
init {
val receiver: CoroutineContext = Job()
val other: CoroutineContext = Dispatchers.Main
// combine two contexts to create an entirely new instance
val newContext: CoroutineContext = receiver + other
coroutineContext = newContext
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment