Remy Benza
06/28/2022, 5:11 PMval singleDispatcher = Dispatchers.IO.limitedParallism(1)
suspend fun codeBlockA() = withContext(singleDispatcher) { .. }
suspend fun codeBlockB() = withContext(singleDispatcher) { .. }
Never in time will code inside functions codeBlockA and codeBlockB  be running at the same time. Irrespective of when / how often they are invoked and/or what parent coroutine there are launched from. Correct?Remy Benza
06/28/2022, 5:12 PMcodeBlockB is invoked while codeBlockA is still executing, the singleDispatcher will then 'queue' the coroutine until singleDispatcher is 'free' for execution?
Similar to thread confinement?Remy Benza
06/28/2022, 5:19 PMJoffrey
06/28/2022, 5:38 PMRemy Benza
06/29/2022, 7:51 AMRemy Benza
07/10/2022, 5:43 PMval singleDispatcher = Dispatchers.IO.limitedParallism(1)
fun myFunction() {
  scope.lauch(singleDispatcher) {
    val a = someOtherFunction() = withContext(<http://Dispatcher.IO|Dispatcher.IO>) { ... }
  }
}Remy Benza
07/10/2022, 5:43 PMJoffrey
07/10/2022, 6:05 PMwithContext(<http://Dispatchers.IO|Dispatchers.IO>) would not be subject to the parallelism limitRemy Benza
07/10/2022, 6:25 PMsingleDispatcher to prevent concurrency?Remy Benza
07/10/2022, 6:26 PMlouiscad
07/10/2022, 6:30 PMMutex is the API you're looking for.Remy Benza
07/10/2022, 6:40 PMmyFunction()  and also preventing concurrency is not possible with .limitedParallism API?Remy Benza
07/10/2022, 6:41 PMsingleDispatcher?louiscad
07/10/2022, 7:02 PM