Closed
Description
We are lacking at least one critical primitive:
recv
onport<T>
with timeout that returns anoption<T>
It may be desirable to recv
from multiple ports at once, which may need
recv
on[port<T>]
that returns(uint, T)
recv
on[port<T>]
with timeout that returnsoption<(uint, T)>
recv_some
on[port<T>]
with timeout that returns[T]
or[(int, T)]
- These calls assume a fixed message type, it would be nice if it was possible to
recv
from a set of differently typed ports at once and match on the result somehow
These calls perhaps would be useful for sending to many channels:
send_any(value: T, channels: [chan<T>])
that returns theuint
vec index of the channel actually used- with the channel selected fairly from
channels
- with the channel selected fairly from
send_ready(value: T, channels: [chan<T>])
that returns theuint
vec index of the channel actually used- with the channel selected fairly among ready channels from
channels
- with the channel selected fairly among ready channels from
send_all(value: T, channels: [chan<T>])
- for convenience