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

digitalsanctum

10/10/2018, 6:56 PM
I'm getting started using coroutines and attempting to do a fan out with single producer and multiple consumers. if executing via main, what's the best way to signal the main thread when consumers are done consuming without using
delay
?
e

elizarov

10/10/2018, 6:58 PM
Keep track of all consuming coroutines (put them in a list) and use joinAll() on that list.
d

digitalsanctum

10/10/2018, 7:00 PM
will that work even if consumers are calling an async api? thanks for reply
e

elizarov

10/10/2018, 7:01 PM
Yes.
d

digitalsanctum

10/10/2018, 7:06 PM
works great. thanks again!