https://kotlinlang.org logo
Title
o

Olekss

01/26/2018, 8:23 AM
I know, but still - if I have 3 net connections downloading stuff and stuffing it into one data structure, I can't do much around it... I am still stuck with synchronization BS, or copy problems etc. Ok not your problem anyway 🙂
g

gildor

01/26/2018, 8:24 AM
You can relatively easy write thread safe code with coroutines. For example using actors or another approach that removes shared mutable state
o

Olekss

01/26/2018, 8:25 AM
Exactly... only with actors and channels -> Thats fairly new to me, so need to unlearn old JAVA thinking.
ok thanks
g

gildor

01/26/2018, 8:26 AM
I don’t know how your “data structure” for result works, so cannot recommend particular solution, but maybe you can do that even without actors, just use coroutines to handle results in a particular thread so no more concurrency problem
Be free to ask your questions in #coroutines
l

louiscad

01/26/2018, 9:16 AM
@Olekss If you're uncomfortable with #coroutines, I strongly advise you to read this guide thoroughly: https://github.com/Kotlin/kotlinx.coroutines/blob/master/coroutines-guide.md
o

Olekss

01/26/2018, 10:29 AM
@louiscad No worries. I am comrofrable with coroutines. Was new cocept to me from Kotlin, but now I can't imagine how one can live without them.