method poll

Documentation for method poll assembled from the following types:

class Channel

From Channel

(Channel) method poll

Defined as:

method poll(Channel:D:)

Receives and removes an item from the channel. If no item is present, returns Nil instead of waiting.

my $c =; { $c.close}
^10 .map({ $c.send($_); });
loop {
    if $c.poll -> $item { $item.say };
    if $c.closed  { last };
    sleep 0.1;

See method receive for a blocking version that properly responds to channel closing and failure.