【发布时间】:2020-06-15 13:11:06
【问题描述】:
from multiprocessing import Process
import time
print('test')
def plint():
print('here')
def parallel():
if __name__ == "__main__":
p1 = Process(target = plint)
p1.start()
while True:
parallel()
time.sleep(2)
程序一直只输出'test',没有进入'plint'函数并打印'here'。有人可以帮忙吗?
编辑:当我在没有循环的情况下运行相同的代码时,它会输出两次“测试”,然后打印一次“这里”。使用循环它甚至不会到达“这里”。
【问题讨论】:
标签: python multithreading