louiscad
10/22/2018, 12:41 PMcoroutineScope {
val daemonLikeJob = launch { while (true) /* Do sth until everything is done */ }
coroutineScope {
launch { /* do work */ }
launch { /* do work */ }
}
daemonLikeJob.cancel()
}robin
10/22/2018, 12:44 PMlouiscad
10/22/2018, 1:03 PMrobin
10/22/2018, 2:30 PMlouiscad
10/22/2018, 2:43 PMrobin
10/22/2018, 3:10 PMlouiscad
10/22/2018, 3:14 PMval scopeJob = coroutineContext[Job]!!), launch the daemon from GlobalScope or another global but custom scope, and call scopeJob.invokeOnCompletion { daemonJob.cancel() }robin
10/22/2018, 3:16 PM