Tower Guidev2
04/29/2022, 10:59 AMisActive
as an approach to "join in with cancellation", however isActive
Tower Guidev2
04/29/2022, 12:55 PMyield()
which seemed to do the trick, is that wrong?Stylianos Gakis
04/29/2022, 1:03 PMcurrentCoroutineContext().isActive
will just check for cancellation.
This might matter if you somehow rely on that piece of code not suspending to wait for something else. Practically speaking, in like 99% of the use cases my guess is that it doesn’t matter though 😅 If some coroutine expert would like to chime in to say why I’m wrong I’d love to hear itTower Guidev2
04/29/2022, 1:07 PMyield()
in my Andriod background workers, androidx.work.CoroutineWorker
, so from what you are saying i am good
if i understand correctly 😄Stylianos Gakis
04/29/2022, 1:13 PMCoroutineWorker
before, but yes, yield() does check for cancellation so you’re good 😄