为什么多处理在这段代码中无法在Python中工作?

时间:2016-11-01 07:41:28

标签: python debugging multiprocessing

from multiprocessing import Process
import os
import time

def info(title):
    print(title)
    print('module name:',__name__)
    print('process id:', os.getpid())

def f(name):
    info('function f')
    print('hello',name)

if __name__ == '__main__':
    info('main line')
    p = Process(target = f,args=('bob',))
    p.start()
    p.join()

'''结果如下:''' Obviously, the multiprocessing cannot work as expected,why?

main line
module name: __main__
process id: 10548

0 个答案:

没有答案