File tree 1 file changed +6
-1
lines changed
kotlinx-coroutines-core/common/src/flow
1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,10 @@ private suspend fun <T> FlowCollector<T>.emitAllImpl(channel: ReceiveChannel<T>,
51
51
* - Flow collectors are cancelled when the original channel is [closed][SendChannel.close] with an exception.
52
52
* - Flow collectors complete normally when the original channel is [closed][SendChannel.close] normally.
53
53
* - Failure or cancellation of the flow collector does not affect the channel.
54
+ * However, if a flow collector gets cancelled after receiving an element from the channel but before starting
55
+ * to process it, the element will be lost, and the `onUndeliveredElement` callback of the [Channel],
56
+ * if provided on channel construction, will be invoked.
57
+ * See [Channel.receive] for details of the effect of the prompt cancellation guarantee on element delivery.
54
58
*
55
59
* ### Operator fusion
56
60
*
@@ -71,7 +75,8 @@ public fun <T> ReceiveChannel<T>.receiveAsFlow(): Flow<T> = ChannelAsFlow(this,
71
75
*
72
76
* - Flow collector is cancelled when the original channel is [closed][SendChannel.close] with an exception.
73
77
* - Flow collector completes normally when the original channel is [closed][SendChannel.close] normally.
74
- * - If the flow collector fails with an exception, the source channel is [cancelled][ReceiveChannel.cancel].
78
+ * - If the flow collector fails with an exception (for example, by getting cancelled),
79
+ * the source channel is [cancelled][ReceiveChannel.cancel].
75
80
*
76
81
* ### Operator fusion
77
82
*
You can’t perform that action at this time.
0 commit comments