Arun Joseph
01/26/2022, 3:56 PMbezrukov
01/26/2022, 4:06 PMvmScope.coroutineContext + job
to get it working.bezrukov
01/26/2022, 4:08 PMjob
won't be canceled. To make it working you need to define Job's parent<->child relation:
val job = Job(vmScope.coroutineContext.job) // now new Job is a child of job from vmScope
val newScope = CoroutineScope(vmScope.coroutineContext + job)
Arun Joseph
01/26/2022, 4:09 PMArun Joseph
01/26/2022, 5:06 PMvmScope.coroutineContext + job
first, found that job wasn't cancelled when vmScope is cleared.
Then with
val job = Job(vmScope.coroutineContext.job) // now new Job is a child of job from vmScope
val newScope = CoroutineScope(vmScope.coroutineContext + job)
the job is cancelled on job.cancel and when vmScope is cleared.
Thanks!Arun Joseph
01/26/2022, 5:12 PMval job = Job(vmScope.coroutineContext.job) // now new Job is a child of job from vmScope
val newScope = CoroutineScope(job)
bezrukov
01/26/2022, 5:15 PM