https://kotlinlang.org logo
#coroutines
Title
# coroutines
u

uhe

11/23/2018, 2:25 PM
In this snippet, the theoretical resource is not released, when the coroutineContext is cancelled before
produce
has been started. Is it possible to avoid this race?
I just realized it's perfectly fine to just move the resource acquisition into the produce block. Rubber-ducked myself again...
s

spand

11/23/2018, 2:39 PM
You might want to take a look at start=ATOMIC
u

uhe

11/23/2018, 2:43 PM
But you can't use that with
produce
, right?
2 Views