dave08
12/27/2018, 1:04 PMclass Foo { suspend fun execute(): Bar } and I want to limit that execute should not run in parallel is the simplest way (without channels) to use newSingleThreadContext to create one thread context in the class and use it in withContext(executeContext) in execute? Is there anything wrong with this, or a better way?Dominaezzz
12/27/2018, 1:11 PMMutex. https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.sync/-mutex/dave08
12/27/2018, 1:13 PMDominaezzz
12/27/2018, 1:17 PMdave08
12/27/2018, 1:19 PMexecute in parallel AFAIK, which is not what I want. By limiting to one thread, it'll block until I return the first result. I could call this from many threads and it should still be FIFO.Dominaezzz
12/27/2018, 1:23 PMMutex).dave08
12/27/2018, 1:23 PMDominaezzz
12/27/2018, 1:23 PMDominaezzz
12/27/2018, 1:24 PMdave08
12/27/2018, 1:24 PMMutex?dave08
12/27/2018, 1:26 PMthere might be no thread switching
Mutex is less overhead than that switching I'm saving?Dominaezzz
12/27/2018, 1:27 PMdave08
12/27/2018, 1:28 PM