# New Ticket Created by Rob Hoelz # Please include the string: [perl #126425] # in the subject line of all future correspondence about this issue. # <URL: https://rt.perl.org/Ticket/Display.html?id=126425 >
Consider the following two programs: parent.pl: my $child = Proc::Async.new('perl6', 'child.pl', :w); $child.stdout.tap: { .say }; $child.print: "1\n"; $child.kill: SIGINT; $child.print: "2\n"; child.pl: signal(SIGINT).act: { say 'SIGINT'; exit } my $ = get(); say 'one'; my $ = get(); say 'two'; say 'done'; There are seven Proc::Async related events that occur when you run parent.pl: - "1\n" is sent to the child on standard input. - "one\n" is received from the child on standard output. - SIGINT is sent to the child. - "SIGINT\n" is received from the child on standard output. - "2\n" is sent to the child on standard input. - "two\n" is received from the child on standard output. - "done\n" is received from the child on standard output. If this program behaved correctly, not all of these events would occur, but due to the way these methods are implemented, the ordering may change. 7! is 5040, but I wrote a little program to prune orderings that just can't happen (ex. the child will always receive "1\n" before "2\n"). That program indicates that there are 42 possible orderings; I haven't observed so many when running this program, but I have observed a few. I understand that Proc::Async is asynchronous in all its dealings (hence the name), but the way the code looks feels very synchronous. Either the nondeterministic orderings should be fixed, or maybe the API should change to reflect that here be dragons. This affects S17-procasync/kill.t.