@@ -687,8 +687,7 @@ fun <T, U> Publisher<T>.takeUntil(context: CoroutineContext, other: Publisher<U>
687
687
```
688
688
689
689
This code is using [ whileSelect] as a nicer shortcut to ` while(select{...}) {} ` loop and Kotlin's
690
- [ use] ( https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.io/use.html )
691
- expression to close the channels on exit, which unsubscribes from the corresponding publishers.
690
+ [ consume] expressions to close the channels on exit, which unsubscribes from the corresponding publishers.
692
691
693
692
The following hand-written combination of
694
693
[ range] ( https://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Flowable.html#range(int,%20int) ) with
@@ -751,11 +750,8 @@ fun <T> Publisher<Publisher<T>>.merge(context: CoroutineContext) = GlobalScope.p
751
750
}
752
751
```
753
752
754
- Notice the use of
755
- [ coroutineContext] ( https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.coroutines/coroutine-context.html )
756
- in the invocation of [ launch] coroutine builder. It is used to refer
757
- to the context of the enclosing ` publish ` coroutine. This way, all the coroutines that are
758
- being launched here are [ children] ( ../docs/coroutines-guide.md#children-of-a-coroutine ) of the ` publish `
753
+ Notice that all the coroutines that are
754
+ being launched here are the children of the ` publish `
759
755
coroutine and will get cancelled when the ` publish ` coroutine is cancelled or is otherwise completed.
760
756
Moreover, since the parent coroutine waits until all the children are complete, this implementation fully
761
757
merges all the received streams.
@@ -1052,7 +1048,6 @@ coroutines for complex pipelines with fan-in and fan-out between multiple worker
1052
1048
[ runBlocking ] : https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/run-blocking.html
1053
1049
[ Dispatchers.Unconfined ] : https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-dispatchers/-unconfined.html
1054
1050
[ yield ] : https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/yield.html
1055
- [ launch ] : https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/launch.html
1056
1051
[ Dispatchers.Default ] : https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-dispatchers/-default.html
1057
1052
[ Job.join ] : https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-job/join.html
1058
1053
<!-- - INDEX kotlinx.coroutines.channels -->
0 commit comments