How do I implement some logic that will allow me to reproduce on Windows the functionality that I have on Linux with the fork()
system call, using Python?
I'm specifically trying to execute a method on the SAPI Com component, while continuing the other logic in the main thread without blocking or waiting.
Possibly a version of spawn() for python? http://en.wikipedia.org/wiki/Spawn_(operating_system)
Use the python multiprocessing module which will work everywhere.
Here is a IBM developerWords article that shows how to convert from os.fork() to the multiprocessing module.
In addition to the process management code in the os module that Greg pointed out, you should also take a look at the threading module: https://docs.python.org/library/threading.html
Have a look at the process management functions in the os module. There are function for starting new processes in many different ways, both synchronously and asynchronously.
I should note also that Windows doesn't provide functionality that is exactly like fork() on other systems. To do multiprocessing on Windows, you will need to use the threading module.
The Threading example from Eli will run the thread, but not do any of the work after that line.
I'm going to look into the processing module and the subprocess module. I think the com method I'm running needs to be in another process, not just in another thread.
fork()
has in fact been duplicated in Windows, under Cygwin, but it's pretty hairy.See the The Cygwin User's Guide for a description of this hack.