Kotlin 1.2 Language Documentationiteration over channels Building channel producers Pipelines Prime numbers with pipeline Fan-out Fan-in Buffered channels Channels are fair Ticker channels Deferred values provide a convenient way (in this example we launch them in the context of the main thread as main coroutine's children): Fan-in 262 fun main(args: Array) = runBlocking { val channel = Channel () launch 0 码力 | 333 页 | 2.22 MB | 1 年前3
Kotlin Language Documentation 1.3iteration over channels Building channel producers Pipelines Prime numbers with pipeline Fan-out Fan-in Bu�ered channels Channels are fair Ticker channels Deferred values provide a convenient way to s: String, time: Long) { while (true) { delay(time) channel.send(s) } } Fan-in 494 Now, let us see what happens if we launch a couple of coroutines sending strings (in this example0 码力 | 597 页 | 3.61 MB | 1 年前3
Kotlin Language Documentation 1.9.20iteration over channels Building channel producers Pipelines Prime numbers with pipeline Fan-out Fan-in Buffered channels Channels are fair Ticker channels Coroutine exceptions handling Exception consumeEach always consumes (cancels) the underlying channel on its normal or abnormal completion. Fan-in Multiple coroutines may send to the same channel. For example, let us have a channel of strings0 码力 | 1299 页 | 32.44 MB | 1 年前3
共 3 条
- 1













