-
-
Save skrisna/8c8dd495952d8beb0642531442898331 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my $channel = Channel.new; | |
await (^20).map: -> $r { | |
start { | |
#sleep (0,1,2).pick; | |
$channel.send({sleep 1; $r}); | |
} | |
} | |
await (^3).map: -> $r { | |
start { | |
while $channel { | |
my $x = $channel.receive; | |
say "Worker $r: Consume $x()"; | |
} | |
} | |
} | |
say now - INIT now; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment