【发布时间】:2017-11-02 01:45:10
【问题描述】:
我的情况如下:
main()
{
create a thread executing function thread_func();
another_func();
}
another_func()
{
//check something and do something.
// To do something, create a child process.
// after creating child process, current thread goes in checking state again
// child process independently running.
}
thread_func()
{
infinite loop(); // checking something and doing something
}
线程是使用 pthread 创建的。 请告诉:在线程中启动像上面这样的子进程是否很好?如果这样做了会发生什么。
子进程是否创建自己的另一个执行thread_func()的复制线程?
谢谢
【问题讨论】:
-
这个链接也可能有用。 stackoverflow.com/questions/39890363/…
标签: c multithreading pthreads fork child-process