Last active
January 13, 2021 15:59
-
-
Save makzimi/a7935ec1ea73a92c9d5dca25d3b81827 to your computer and use it in GitHub Desktop.
Example of how runBlocking can make a deadlock with single thread dispatcher.
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
val singleThreadDispatcher = Executors.newSingleThreadExecutor().asCoroutineDispatcher() | |
GlobalScope.launch(singleThreadDispatcher) { | |
runBlocking(singleThreadDispatcher) { | |
println("Hello, World!") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment