@@ -13,7 +13,12 @@ import kotlin.coroutines.*
1313/* *
1414 * Broadcasts all elements of the channel.
1515 *
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+ *
1722 * @param start coroutine start option. The default value is [CoroutineStart.LAZY].
1823 */
1924fun <E > ReceiveChannel<E>.broadcast (
@@ -45,8 +50,9 @@ fun <E> ReceiveChannel<E>.broadcast(
4550 * the resulting channel becomes _failed_, so that any attempt to receive from such a channel throws exception.
4651 *
4752 * 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,
4954 * * 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].
5056 * * otherwise -- throws [IllegalArgumentException].
5157 *
5258 * **Note:** By default, the coroutine does not start until the first subscriber appears via [BroadcastChannel.openSubscription]
0 commit comments