@@ -13,7 +13,12 @@ import kotlin.coroutines.*
13
13
/* *
14
14
* Broadcasts all elements of the channel.
15
15
*
16
- * @param capacity capacity of the channel's buffer (1 by default).
16
+ * The kind of the resulting channel depends on the specified [capacity] parameter:
17
+ * when `capacity` is positive (1 by default), but less than [UNLIMITED] -- uses `ArrayBroadcastChannel` with a buffer of given capacity,
18
+ * when `capacity` is [CONFLATED] -- uses [ConflatedBroadcastChannel] that conflates back-to-back sends;
19
+ * Note that resulting channel behaves like [ConflatedBroadcastChannel] but is not an instance of [ConflatedBroadcastChannel].
20
+ * otherwise -- throws [IllegalArgumentException].
21
+ *
17
22
* @param start coroutine start option. The default value is [CoroutineStart.LAZY].
18
23
*/
19
24
fun <E > ReceiveChannel<E>.broadcast (
@@ -45,8 +50,9 @@ fun <E> ReceiveChannel<E>.broadcast(
45
50
* the resulting channel becomes _failed_, so that any attempt to receive from such a channel throws exception.
46
51
*
47
52
* The kind of the resulting channel depends on the specified [capacity] parameter:
48
- * * when `capacity` positive (1 by default), but less than [UNLIMITED] -- uses `ArrayBroadcastChannel` with a buffer of given capacity,
53
+ * * when `capacity` is positive (1 by default), but less than [UNLIMITED] -- uses `ArrayBroadcastChannel` with a buffer of given capacity,
49
54
* * when `capacity` is [CONFLATED] -- uses [ConflatedBroadcastChannel] that conflates back-to-back sends;
55
+ * Note that resulting channel behaves like [ConflatedBroadcastChannel] but is not an instance of [ConflatedBroadcastChannel].
50
56
* * otherwise -- throws [IllegalArgumentException].
51
57
*
52
58
* **Note:** By default, the coroutine does not start until the first subscriber appears via [BroadcastChannel.openSubscription]
0 commit comments