Skip to content

Instantly share code, notes, and snippets.

@gfldex
Created September 30, 2016 21:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gfldex/3fc26c5fe03ed90b6160da07667b31cc to your computer and use it in GitHub Desktop.
Save gfldex/3fc26c5fe03ed90b6160da07667b31cc to your computer and use it in GitHub Desktop.
sub find-simple (:$no-thread) {
my $channel = Channel.new;
my &start = -> ( &c ) { c } if $no-thread;
my $promise = start {
for 1..10 {
CATCH { default { .rethrow } }
$channel.send(.Int);
die "bad";
}
$channel.close;
}
return $channel.list;
# return $channel.list but role :: { method channel { $channel } };
}
say find-simple();
# say find-simple(:no-thread); # this hangs too
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment