danny
12/06/2018, 7:09 PMCoroutineScheduler
seems far too conservative about parking threads?Thread.yield
from cpuWorkerIdle
- about double the system CPU time as user time. I must only have a few dozen coroutines runningfun main() {
runBlocking {
val count = AtomicInteger()
val ints = produce<Int> {
repeat(10) {
launch(Dispatchers.Default) {
while (true) {
channel.send(count.incrementAndGet())
}
}
}
}
for (int in ints) {
// Single consumer doing something expensive that can't be concurrent
Thread.sleep(2)
}
}
}
Vsevolod Tolstopyatov [JB]
12/07/2018, 11:23 AMdanny
12/10/2018, 9:01 PMDispatchers.Default
and not IO
Vsevolod Tolstopyatov [JB]
12/12/2018, 1:46 PM