有没有办法在不终止其他线程的情况下生成新进程?

时间:2013-08-29 17:05:02

标签: c linux pthreads exec

我正在Linux上编写多线程程序,并希望在线程中创建一个进程,而不会结束其他线程。我查看了fork / exec,但在linux上的第3p节的exec手册页中说明了:

 A call to any exec function from a process with more  than  one  thread
 shall  result  in  all  threads being terminated and the new executable
 image being loaded and  executed.  No  destructor  functions  shall  be
 called.

有没有办法在不终止其他线程的情况下生成新进程?

1 个答案:

答案 0 :(得分:3)

但是如果你首先fork()和exec在子进程中,子进程只有一个线程,并且被exec函数销毁。父进程及其所有线程不受影响。

相关问题