https://kotlinlang.org logo
#coroutines
Title
# coroutines
d

danny

10/18/2018, 12:27 AM
What's the state of
<http://Dispatchers.IO|Dispatchers.IO>
? I'm seeing different behavior to the documentation, and some scheduling weirdness
For instance, the docs state that they use the same threads as the default dispatcher, but right now that's still the fork/join pool?
And when I do use it, I get ~30 threads burning a bunch of CPU in
Thread.yield()
Copy code
CoroutineScheduler-worker-24  Runnable CPU usage on sample: 16ms
@
kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.cpuWorkerIdle() CoroutineScheduler.kt:781
I'd only launched 8 coroutines in this case, I needed to constraint to a relatively small number of concurrent connections
d

dave08

10/18/2018, 3:25 AM
Just use fan out structure like in the guide (or on Roman's KotlinConf 18 speech)
e

elizarov

10/18/2018, 4:49 AM
What version are you using?
There were some bugs in the past and there were some changes recently. 0.30.2 should be good tho
d

dave08

10/18/2018, 5:00 AM
@elizarov In 0.30.0 there are still bugs? I'm about to release an android app to production, using it, I can't wait till 1.0.0 and kotlin 1.3, and as far as I understood there's still open issues with gradle 4.10.2 metadata and proguard in 0.30.2, is it safe to use 0.30.0?
Or is there a way to overcome the gradle and proguard issues?
This app has alot of devices depending on it... I can't really take chances...
e

elizarov

10/18/2018, 5:04 AM
Both gradle and proguard issues have workarounds. You can wait a bit for 1.0.0-rc release that has them solved tho.
d

dave08

10/18/2018, 5:06 AM
1.0.0 rc is without kotlin 1.3? I can't wait for more than today or maximum sunday..
And I can't use kotlon 1.3 beta for it either...
e

elizarov

10/18/2018, 5:06 AM
0.30.2 is better than 0.30.0 and has its dispatcher bugs fixed
Go with 0.30.2
d

dave08

10/18/2018, 5:08 AM
What about the issues? I need proguard, and android studio 3.2 requires grdle over 4.7?
Would it be possible to have 0.30.3 just for these issues?
e

elizarov

10/18/2018, 5:09 AM
You don’t enable experimental Gradle Metadata then it works with any version
👍🏼 1
ProGuard issues only manifest if you use AndroidX and you can easily workaround with rules.
👍🏼 1
d

danny

10/18/2018, 4:02 PM
I thought I upgraded, but maybe not - I'll double check. Thanks for the assist!
Oh yeah, I was way back on
0.26.1-eap13
2 Views