https://kotlinlang.org logo
#coroutines
Title
# coroutines
m

mingkangpan

09/09/2019, 4:00 PM
hey guys, I am really having a hard time understand the
BroadcastArrayChannel
could someone try to explain it to me, especialy in which scenario this channel can be used?
d

Dominaezzz

09/09/2019, 4:02 PM
You shouldn't use that class directly.
You should use the
BroadcastChannel
abstraction.
but fwiw
BroadcastArrayChannel
is a fixed-sized buffered
BroadcastChannel
.
m

mingkangpan

09/09/2019, 4:07 PM
yeah I know that I shouldnt use it directly I try to understand what is a Broadcastchannel with 1 capacity? what is the different if a broadcast channel has n capcities?
d

Dominaezzz

09/09/2019, 4:14 PM
A broadcast channel with n capacity will hold up to n items before suspending the sender.
m

mingkangpan

09/09/2019, 5:47 PM
but n items for each receiver or n items for n receiver?
d

Dominaezzz

09/09/2019, 6:36 PM
All receivers share the buffer.
4 Views