3.1 Multicast Asynchronous Channels
This provides an implementation of multicast channels, an
extension of asynchronous channels
that may have multiple recievers. Unlike asynchronous channels, multicast
channels have distinct “server” and “receiver” objects, since
multicast channels create a one-to-many relationship.
Ported from dynamically typed implementation by Alexis King.
The Multicast-Channelof parameterized by the type of the broadcast message being sent/received. e.g. (Multicast-Channelof String).
The Multicast-Receiverof type that is parameterized by the broadcast message type being received/sent. e.g. (Multicast-Receiverof String).
Creates and returns a new Multicast-Channelof instance.
A created instance of Multicast-Channelof weakly holds instances of created Multicast-Receiverof instances allowing for automatic gc’ing and cleanup.
Creates a receiver asynchronous channel that receives messages from mc
. The returned value is
a type alias for a standard Async-Channelof
, but it does not
Attempting to write to a receiver channel will raise an exception.
The created Multicast-Receiverof instance is weakly held by the Multicast-Channelof instance creator. When the client caller to this method lets the returned Multicast-Receiverof instance go out of scope it will be gc’d and de-registered from the Multicast-Channelof instance. Explicit closing of a Multicast-Receiverof instance is not required.
Broadcasts v of to all receivers listening to mc.