Patrick Steiger
12/06/2022, 2:41 AMcoroutineScope { ensureActive() }
?ephemient
12/06/2022, 3:15 AMJoffrey
12/06/2022, 9:32 AMsuspend fun main
, isActive
will be false. It might be safer to use isActive
on a temporary scope (with job) if you don't control the calling context, and you want the "not cancelled" semanticsJoffrey
12/06/2022, 9:33 AMhfhbd
12/06/2022, 10:13 AMsuspend fun main() = coroutineScope {
Patrick Steiger
12/06/2022, 7:13 PMcoroutineScope
— it just feels higher-level API and if context doesn’t have a job it will create one so I’ll be sure to call ensureActive
in a scope with a job. In fact thinking of it I don’t know why every suspend fun does not get an implicit CoroutineScope with Job as a receiver by compiler magic but that’s another topicephemient
12/06/2022, 7:16 PM