How can I start a sub-process in Windows?

后端 未结 1 1667
醉梦人生
醉梦人生 2021-01-12 08:11

In POSIX, there is the fork() function to create a sub-process. How can I achieve fork()\'s functionality in Windows?

相关标签:
1条回答
  • 2021-01-12 08:48

    There is no direct equivalent of fork() on Windows.

    CreateProcess() is the native function that can be used to create a new process (but, again, the semantics are rather different to fork()'s).

    To put this another way, on Unix it is possible for a process to cheaply create a clone of itself. There is no inexpensive way to do this on Windows.

    If you don't care about the cloning aspect of fork(), then CreateProcess() should do just fine.

    0 讨论(0)
提交回复
热议问题