首页 > 编程语言 > 详细

python3 获取子进程的name

时间:2019-06-02 22:23:45      阅读:240      评论:0      收藏:0      [点我收藏+]
# coding:utf-8
import time
from multiprocessing import Process


def func1():
    print("func1 start...")
    time.sleep(1)
    print("func1 end...")


def func2():
    print("func2 start...")
    time.sleep(1)
    print("func2 end...")

if __name__ == __main__:
    print("主程序开始了.")
    p1 = Process(target=func1,)
    p2 = Process(target=func2,)
    p1.start()
    p2.start()
    print("子程序1名字:", p1.name)
    print("子程序2名字:", p2.name)
    print("主程序结束了.")


执行结果:
# 主程序开始了. # 子程序1名字: Process-1 # 子程序2名字: Process-2 # 主程序结束了. # func1 start... # func2 start... # func1 end... # func2 end...

 

python3 获取子进程的name

原文:https://www.cnblogs.com/lilyxiaoyy/p/10964630.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!