Is there a recommended <thread safe data structure...
# multiplatform
d
Is there a recommended thread safe data structure to be used when you want to have a set of listeners that are called for certain actions, something that in JVM could be solved with
CopyOnWriteArraySet
?
Copy code
private val actionListeners: MutableCollection<ActionListener> = CopyOnWriteArraySet()
in practice I need it for JVM/Android and iOS
maybe the KMP alternative would be to use a
Channel
that emits
Action
instead of a
ActionListener
or a
SharedFlow
p
I would say a SharedFlow/StateFlow yes