0

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

 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.

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

4

1 回答 1

3

但是如果你先 fork() 并在子进程中执行,则子进程只有一个线程,并且被 exec 函数破坏。父进程及其所有线程不受影响。

于 2013-08-29T17:20:51.513 回答