I have a PipeLine
class for running third-party programs: https://github.com/mikelsv/opensource/blob/master/msvcore/crossplatform/console.cpp#L590 .
To run a third-party program, you need to call Run()
, passing in the name of the program. https://github.com/mikelsv/opensource/blob/master/msvcore/crossplatform/console.cpp#L694
The Run()
function creates 4 pipes, then, using the fork()
call, creates another process in which the specified program is started via system()
. It also redirects stdin and company to the parent process.
This code works fine, but periodic “freezes” are seen on select()
, https://github.com/mikelsv/opensource/blob/master/msvcore/crossplatform/console.cpp#L814 .
I run / usr / bin / php-cgi, at least a couple of times per minute. About once every half hour, one of the threads hangs on select()
. There is no php-cgi in the process list. It seems that the child thread is terminated without closing the pipe, but I do not see how this situation can arise.
Tell me where there may be an error.