Jason Zhao
01/08/2024, 1:45 PMuli
01/08/2024, 2:07 PMUNDISPATCHED
Immediately executes the coroutine until its first suspension point in the current thread similarly to the coroutine being started using Dispatchers.Unconfined. However, when the coroutine is resumed from suspension it is dispatched according to the CoroutineDispatcher in its context.
https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-start/-u-n-d-i-s-p-a-t-c-h-e-d/Jason Zhao
01/08/2024, 2:26 PMThe resulting view uses the original dispatcher for execution, but with the guarantee that no more than parallelism coroutines are executed at the same time.
Since it's a "guarantee" that only 1 coroutine (in this case) can execute at the same time, it shouldn't be possible for something like CoroutineStart.UNDISPATCHED to break this guarantee. So which documentation is wrong? 😵💫uli
01/08/2024, 2:29 PMJason Zhao
01/08/2024, 2:31 PMuli
01/08/2024, 2:32 PMthe guarantee that no more than parallelism coroutines are executed at the same time.
does not mean, that one coroutine waits for the other to finish, but only for the other to suspend?Jason Zhao
01/08/2024, 2:32 PMJason Zhao
01/08/2024, 2:33 PMuli
01/08/2024, 2:33 PMuli
01/08/2024, 2:34 PMJason Zhao
01/08/2024, 2:35 PMuli
01/08/2024, 2:35 PMJason Zhao
01/08/2024, 2:39 PMJason Zhao
01/08/2024, 2:40 PM