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

myanmarking

02/04/2020, 10:44 AM
is it possible to check if there are active jobs within a coroutineScope ?
m

myanmarking

02/04/2020, 10:51 AM
no, it doesn't 😛 thanks anyway
j

José Cardoso

02/04/2020, 10:51 AM
meh
d

Dico

02/04/2020, 12:00 PM
You can do
scope[Job].children.find { it.isActive }
This isn't universal, depends on what children you add, but if you don't create child scopes using
Job(scope[Job])
you should be fine.
t

tseisel

02/05/2020, 7:51 AM
An alternative would be to execute your actions with an actor. With the default capacity, it ensures that only one action is executed at a given time, suspending requests to execute another action until done with the current.
10 Views