On Tue, 20 Dec 2016 05:07:57 -0800, jn...@jnthn.net wrote: > On Sun, 18 Dec 2016 06:24:38 -0800, alex.jakime...@gmail.com wrote: > > This is probably best demonstrated by a code snippet. > > > > Code: > > > > my $out = Channel.new; > > #my $proc = Proc::Async.new(‘perl6’, ‘-e’, ‘sleep ∞’); # ← this works > > my $proc = Proc::Async.new(‘perl6’, ‘-e’, ‘.say for 0..0x1FFFF’); # ← > > this doesn't > > $proc.stdout.tap({ $out.send: 1 }); > > > > my $promise = $proc.start; > > say ‘let's await ’, now; > > await Promise.anyof(Promise.in(1), $promise); > > say ‘let's close ’, now; > > $proc.kill; > > await $promise; > > $out.close; > > say ‘that's it ’, now; > > > > > > The idea is that we want to kill our process if it is still working > > after 1 second. This works fine, unless the process is writing a lot > > of stuff to stdout. > > > At present, the default scheduler has a single work queue, and if the > output from the process is not being processed at the rate it's coming > in then the queue will end up with a backlog, and the timer event - > placed into the same queue - will be delayed. In the future, we'll get > around to having a smarter scheduler. In the meantime, I suggest > creating a second scheduler to use for timer (or Proc::Async) events. >
The new scheduler has a separate queue for time-based events, and seems to do notably better at this.