On Mon, 10 Jul 2017, Jan Henning Thorsen wrote:

> The reason why you're seeing the polling is because of the implementation 
> in the CGI plugin. You can see it 
> here: 
> https://github.com/jhthorsen/mojolicious-plugin-cgi/blob/master/lib/Mojolicious/Plugin/CGI.pm#L35

There might be portability issues to non-POSIX environments, but you can 
avoid the polling by using "the selfpipe trick".  Install a proper 
SIGCHILD hander instead of using a polling loop to detect exiting child 
processes.

Your sigchild handler just needs to write a single byte into the pipe 
where your event loop poll can detect it and do whatever is required.

https://cr.yp.to/docs/selfpipe.html
https://www.sitepoint.com/the-self-pipe-trick-explained/
https://lwn.net/Articles/177897/

Reply via email to