Takes the oldest value, blocking while the channel is empty. .CLOSED once it is closed and
drained, .CANCELED if the fiber is canceled while it waits.
Io :: #import "Extensions/Io";
Io.io_run(() {
channel := Io.make_channel(int, 1);
defer Io.free_channel(channel);
Io.spawn((c: *Io.Channel(int)) { Io.send(c, 7); }, channel);
value, error := Io.recv(channel); // waits for the spawned fiber
assert(error == .NONE && value == 7);
});recv :: (channel: *Channel($T)) -> (T, Io_Error)
Parameters
- channel: *Channel($T)
Returns
- T