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

deviant

03/19/2017, 3:20 PM
hi guys! i'm going to implement coroutined version of
list.forEachIndexed
. i need the items order to be preserved, but each item should be processed in a separate thread (pool of 4 threads). is it a good idea to implement it via channels?
e

elizarov

03/19/2017, 3:45 PM
You can create four coroutines, all receiving from the same channel. Send all the work you need them to do to this channel. This pattern is known as "worker pool".
👍 1
4 Views