I have problem with my multithread application. When at one thread executing synchronous popen()
command - other application threads are slow down significantly. Thread with popen()
execute ffmpeg
, that generates high load.
Normally, other threads execution time is 0.0007 ms. And when popen
is used, some threads are increasing there execution time up to 14-20 seconds.
How to solve this problem?
System is FreeBSD 6.4
FILE *pipe;
char buff[512];
if ( !(pipe = popen( command.c_str(), "r")) )
{ // if pipe is NULL
return false;
}
while ( fgets(buff, sizeof(buff), pipe) != NULL )
{
ptr_output->append(buff);
}
here is new code of popen can that does NOT help: Correct Code - Non-blocking pipe with popen