FixTask Documentation
Back to summary
import "task/channel";
ChannelSet class
ChannelSet allows to efficiently receive messages from multiple channels.
Functions
static function create(): ChannelSet
-
Creates a new channel set.
function add(channel: Channel, key)
-
Adds a channel to the set. The provided key is used to identify the channel
when receiving the messages.
function remove(channel: Channel)
-
Removes a channel from the set.
function receive(): Dynamic
function receive(timeout: Integer): Dynamic
function receive(timeout: Integer, timeout_key): Dynamic
-
Receives a message from any of the channels in the set. You can provide an
optional timeout (in milliseconds, negative value disables the timeout).
The function returns two values. The first one is the key (or a special value)
and the second is the message (or an error). You can check for the special key
values using the
is_timeout
and is_error
functions in
the Channel class.