How to start a subprocess on Windows?

On POSIX, there is a fork() function to create a subprocess. How can I achieve fork() functionality on Windows?

+6
source share
1 answer

On Windows, there is no direct equivalent to fork() .

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

In other words, on Unix, you can cheaply create a clone of yourself for a process. 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.

+7
source

Source: https://habr.com/ru/post/907688/


All Articles