> On 8 Sep 2017, at 05:16, Norman Gaywood <ngayw...@une.edu.au> wrote:
> 
> Several weeks ago there was this post:
> http://www.evanmiller.org/why-im-learning-perl-6.html
> 
> That gave this example of perl6 N:M threads in action:
> 
> use v6.d.PREVIEW;
> 
> my $channel = Channel.new;
> 
> my @ten_tasks = (^10).map: {
>     start {
>         my $thread = $*THREAD.id;
>         await $channel;
>         say "HOLY MOLEY SOMEONE STOLE MY THREAD" if $thread != $*THREAD.id;
>     }
> }
> 
> $channel.send("Ring ring") for ^10;
> $channel.close;
> 
> await @ten_tasks;
> 
> 
> It demonstrates that perl6 will not tie up a thread in the thread pool just 
> sitting around waiting (I think).
> 
> The example is intended to be condensed without any surplus code.
> So my question is, is the $channel.close required? Leave it out and the code 
> still seems to work. Am I missing some subtle point?

Jonathan tells me the .close is not required:

https://irclog.perlgeek.de/moarvm/2017-09-11#i_15148891


Liz

Reply via email to