uli
06/18/2018, 3:01 PMproduce
, does `this.close()`cancel the producer? Is this documented?Vsevolod Tolstopyatov [JB]
06/18/2018, 3:45 PMuli
06/18/2018, 3:55 PMoutput.close()
which is a good thing but unexpectedVsevolod Tolstopyatov [JB]
06/18/2018, 4:12 PMsource.switchMap(coroutineContext) { i ->
produce(coroutineContext) { // <- wrong context here is inherited because switchMap lambda doesn't implement CoroutineScope
val switchMapped = source.switchMap(coroutineContext) { i ->
println("Parent Job for producer: ${kotlin.coroutines.experimental.coroutineContext[Job]} vs ${coroutineContext[Job]}")
will print StandaloneCoroutine{Active}@3941a79c vs BlockingCoroutine{Active}@27bc2616
respectively
Your implementation has a bug (accidentally making parent-child relationship for all jobs) 🙂
@hannesstruss implementation looks good modulo cancellationuli
06/18/2018, 4:43 PM