以下代码:
import time, multiprocessing, os
def foo():
logger = multiprocessing.log_to_stderr()
logger.warning(os.getpid())
time.sleep(30)
class Object(object):
def run(self):
for i in range(5):
proc = multiprocessing.Process(target=foo)
proc.start()
for i in range(2):
obj = Object()
proc = multiprocessing.Process(target=obj.run)
proc.start()
开始10个嵌套的multiprocessing.Processes
:
运行上面代码中嵌套使用的Processes
是否安全?