By default coroutines always run on main thread in time shared manner. However, if you really want to force a coroutine to run on separate thread, you can do that. In this video we try to understand what it means to run a coroutine in a multithreaded environment. We also look the the code to understand how it is done. We use withContext to achieve this. There are four types of dispatchers - IO, Default, Non-confined and Main. We also briefly discuss about Coroutine scopes as well in this video. These determine in which thread the coroutine will be run by the Kotlin run time environment.
Follow me on Twitter: / anilvdeshpande
Смотрите видео Multithreaded Coroutines | CoroutineDispatchers | CoroutineScope : Kotlin Fundamentals - 53, онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Codetutor 21 Март 2023, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 1,438 раз и оно понравилось 27 людям.