【发布时间】:2019-01-05 22:54:35
【问题描述】:
这是我的代码在 windows 中不起作用。我应该用什么来代替 fork
import os
print("Process id before forking: {}".format(os.getpid()))
try:
pid = os.fork()
except OSError:
exit("Could not create a child process")
if pid == 0:
print("In the child process that has the PID {}".format(os.getpid()))
exit()
print("In the parent process after forking the child {}".format(pid))
finished = os.waitpid(0, 0)
print(finished)
【问题讨论】:
标签: python python-3.x