Created
September 30, 2016 21:52
-
-
Save gfldex/3fc26c5fe03ed90b6160da07667b31cc 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
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