@@ -370,7 +370,7 @@ flowable that sends five integers from 1 to 5.
370370It prints a message to the output before invocation of
371371suspending [ send] [ SendChannel.send ] function, so that we can study how it operates.
372372
373- The integers are generated in [ CommonPool ] , but subscription is shifted
373+ The integers are generated in the context of the main thread , but subscription is shifted
374374to another thread using Rx
375375[ observeOn] ( http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/Flowable.html#observeOn(io.reactivex.Scheduler,%20boolean,%20int) )
376376operator with a buffer of size 1.
@@ -383,9 +383,9 @@ import io.reactivex.schedulers.Schedulers
383383-->
384384
385385``` kotlin
386- fun main (args : Array <String >) {
387- // coroutine -- fast producer of elements in common pool
388- val source = rxFlowable(CommonPool ) {
386+ fun main (args : Array <String >) = runBlocking< Unit > {
387+ // coroutine -- fast producer of elements in the context of the main thread
388+ val source = rxFlowable(context ) {
389389 for (x in 1 .. 5 ) {
390390 println (" Sending $x ..." )
391391 send(x) // this is a suspending function
@@ -399,7 +399,7 @@ fun main(args: Array<String>) {
399399 println (" Received $x " )
400400 Thread .sleep(200 ) // 200 ms to process each item
401401 }
402- Thread .sleep (2000 ) // hold on main thread for couple of seconds
402+ delay (2000 ) // suspend main thread for couple of seconds
403403}
404404```
405405
@@ -940,9 +940,9 @@ coroutines for complex pipelines with fan-in and fan-out between multiple worker
940940<!-- - DOCS_ROOT kotlinx-coroutines-core/target/dokka/kotlinx-coroutines-core -->
941941<!-- - INDEX kotlinx.coroutines.experimental -->
942942[ runBlocking ] : https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.experimental/run-blocking.html
943- [ CommonPool ] : https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.experimental/-common-pool/index.html
944943[ launch ] : https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.experimental/launch.html
945944[ CoroutineScope.context ] : https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.experimental/-coroutine-scope/context.html
945+ [ CommonPool ] : https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.experimental/-common-pool/index.html
946946[ Unconfined ] : https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.experimental/-unconfined/index.html
947947[ Job.join ] : https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.experimental/-job/join.html
948948<!-- - INDEX kotlinx.coroutines.experimental.channels -->
0 commit comments