@@ -68,6 +68,13 @@ import kotlin.native.concurrent.*
68
68
* the `onBufferOverflow` parameter, which is equal to one of the entries of the [BufferOverflow] enum. When a strategy other
69
69
* than [SUSPENDED][BufferOverflow.SUSPEND] is configured, emissions to the shared flow never suspend.
70
70
*
71
+ * **Buffer overflow condition can happen only when there is at least one subscriber that is not ready to accept
72
+ * the new value.** In the absence of subscribers only the most recent `replay` values are stored and the buffer
73
+ * overflow behavior is never triggered and has no effect. In particular, in the absence of subscribers emitter never
74
+ * suspends despite [BufferOverflow.SUSPEND] option and [BufferOverflow.DROP_LATEST] option does not have effect either.
75
+ * Essentially, the behavior in the absence of subscribers is always similar to [BufferOverflow.DROP_OLDEST],
76
+ * but the buffer is just of `replay` size (without any `extraBufferCapacity`).
77
+ *
71
78
* ### Unbuffered shared flow
72
79
*
73
80
* A default implementation of a shared flow that is created with `MutableSharedFlow()` constructor function
@@ -221,9 +228,12 @@ public interface MutableSharedFlow<T> : SharedFlow<T>, FlowCollector<T> {
221
228
* @param replay the number of values replayed to new subscribers (cannot be negative, defaults to zero).
222
229
* @param extraBufferCapacity the number of values buffered in addition to `replay`.
223
230
* [emit][MutableSharedFlow.emit] does not suspend while there is a buffer space remaining (optional, cannot be negative, defaults to zero).
224
- * @param onBufferOverflow configures an action on buffer overflow (optional, defaults to
225
- * [suspending][BufferOverflow.SUSPEND] attempts to [emit][MutableSharedFlow.emit] a value,
226
- * supported only when `replay > 0` or `extraBufferCapacity > 0`).
231
+ * @param onBufferOverflow configures an [emit][MutableSharedFlow.emit] action on buffer overflow. Optional, defaults to
232
+ * [suspending][BufferOverflow.SUSPEND] attempts to emit a value.
233
+ * Values other than [BufferOverflow.SUSPEND] are supported only when `replay > 0` or `extraBufferCapacity > 0`.
234
+ * **Buffer overflow can happen only when there is at least one subscriber that is not ready to accept
235
+ * the new value.** In the absence of subscribers only the most recent [replay] values are stored and
236
+ * the buffer overflow behavior is never triggered and has no effect.
227
237
*/
228
238
@Suppress(" FunctionName" , " UNCHECKED_CAST" )
229
239
public fun <T > MutableSharedFlow (
0 commit comments