Python 多进程问题

Siannodel_ 2016-08-14 11:57:18
Windows系统下
代码
from multiprocessing import Process
import os

# 子进程要执行的代码
def run_proc(name):
print 'Run child process %s (%s)...' % (name, os.getpid())

if __name__=='__main__':
print 'Parent process %s.' % os.getpid()
p = Process(target=run_proc, args=('test',))
print 'Process will start.'
p.start()
p.join()
print 'Process end.'

输出结果:
Parent process 13892.
Process will start.
Process end.

正确的输出结果应该是:
Parent process 928.
Process will start.
Run child process test (929)...
Process end.

代码一样 为什么我没有输出 Run child process test ?
...全文
176 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

19,468

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 图形处理/算法
社区管理员
  • 图形处理/算法社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧