Is it safe to fork from within a thread?

后端 未结 8 901
-上瘾入骨i
-上瘾入骨i 2020-11-28 04:04

Let me explain: I have already been developing an application on Linux which forks and execs an external binary and waits for it to finish. Results are communicated by shm f

8条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-28 04:36

    Provided you quickly either call exec() or _exit() in the forked child process, you're ok in practice.

    You might want to use posix_spawn() instead which will probably do the Right Thing.

提交回复
热议问题