启动和监视另一个可执行文件的多线程应用程序

Multithreading app that lauches and monitor another executable

我找到了一个使用 fork 和 execvp 启动代码的代码

但后来通过挖掘网络我意识到它与多线程不兼容

所以现在我很困惑...

"the Pthreads standard specifies that an exec call from any thread must terminate all threads in the process and start a single new thread at main in the new image."

我确实需要多线程,所以在这种情况下我如何启动外部可执行文件,检查它是否 运行 并偶尔终止它?

谢谢

那我想我会用system(),谢谢你的精彩支持

[评论不再有效]