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

Stephane M

04/11/2019, 11:51 AM
Hi all, quick question for a newbie. I have a
List<Node>
. I want to run a repeated background job on each node in that list (independently), that fetches some data from a URL and mutates the node state at each iteration. At some point I want to be able to stop the entire job altogether. Do you have any pointers? I'm a bit lost with coroutines
t

tseisel

04/11/2019, 12:21 PM
Roman's Talk at KotlinConf 2018 explains well how you can solve this problem using coroutines channels :

https://www.youtube.com/watch?v=a3agLJQ6vt8

This article explains further, and has links to full code sample from the talk : https://medium.com/@elizarov/deadlocks-in-non-hierarchical-csp-e5910d137cc
2 Views