fork

Is it safe to call system(3) from multi-threaded process?

你。 提交于 2020-08-04 05:14:31
问题 system() function is implemented by using fork() , execve() and wait() functions. I have heard that fork() function is dangerous in multi-threaded programs. So, is the system() function also dangerous in multi-threaded programs? What problems it may cause? 回答1: fork is dangerous in threaded programs unless followed by execve . Since only the current thread is forked there's very little you can do in a forked multi-threaded program other than execve . You should probably make sure you're not