A send that gives up instead of blocking: whether the value was taken.
Io :: #import "Extensions/Io";
Io.io_run(() {
channel := Io.make_channel(int, 1);
defer Io.free_channel(channel);
assert(Io.try_send(channel, 1));
assert(!Io.try_send(channel, 2)); // full
});try_send :: (channel: *Channel($T), value: T) -> bool
Parameters
- channel: *Channel($T)
- value: T
Returns
- bool