Created
June 3, 2023 10:41
-
-
Save omkar-tenkale/9d25014a8403500bc87ed1c7f9f9ba9a 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
fun main() { | |
launch(Dispatcher.Background) { | |
fun1(Dispatcher.Background) | |
} | |
} | |
suspend fun fun1(dispatcher: Dispatcher){ | |
... | |
fun2(dispatcher) | |
... | |
} | |
suspend fun fun2(dispatcher: Dispatcher){ | |
... | |
when (dispatcher) { | |
Dispatcher.Main -> Handler(Looper.getMainLooper()).post { cont.resumeWith() } | |
Dispatcher.Background -> thread { cont.resumeWith() } | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment