Skip to content

Instantly share code, notes, and snippets.

@ugexe
Last active October 13, 2017 18:15
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 ugexe/ee12646ef6ee1302a54a30cf85b3639b to your computer and use it in GitHub Desktop.
Save ugexe/ee12646ef6ee1302a54a30cf85b3639b to your computer and use it in GitHub Desktop.
RAKUDO_SCHEDULER_DEBUG=1 perl6-gdb-m --ll-exception -e 'while 1 { use v6.d.PREVIEW; my %c = (:0reactor_count); my $s = supply { whenever IO::Socket::Async.listen("0.0.0.0", 5000) -> $c-conn { %c{$c-conn}<bar>++; emit $c-conn; %c{$c-conn}<msgs-supplier> = Supplier.new; $c-conn.Supply.lines.tap({ %c{$c-conn}<msgs-supplier>.emit: $_ }); } }; sub start_reactor ($msgs-in) { start { react whenever $msgs-in -> $msg-in { say "before"; say QX("echo foo"); say "after"; %c<reactor_count>++; } } }; start { react whenever $s -> $c-conn { start { start_reactor(%c{$c-conn}<msgs-supplier>.Supply); } } }; sleep 1; my $c = await IO::Socket::Async.connect("0.0.0.0", 5000); await $c.print("foo\n"); sleep 1; }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment