kotlinx.coroutines icon indicating copy to clipboard operation
kotlinx.coroutines copied to clipboard

Investigate possible shortcuts for `coroutineContext.job.invokeOnCompletion { if (it != null) ... }`

Open qwwdfsad opened this issue 3 years ago • 0 comments
trafficstars

The pattern itself is useful for any closeable resources that face non-atomic cancellation (https://github.com/Kotlin/kotlinx.coroutines/issues/1191) as the only reliable way to close it.

Apart from that, the pattern itself is very clunky, but seems to be quite frequent: [1], [2].

We should investigate whether we can provide more convenient extensions on top of CoroutineContext and CoroutineScope

qwwdfsad avatar Apr 19 '22 18:04 qwwdfsad