#! /usr/bin/env python3
# -*- charset = utf-8 -*-
from multiprocessing import Process
import os
# 子进程要执行的代码
def run_pro(name):
print("运行子进程 %s (%s)..." % (name, os.getpid()))
if __name__ == '__main__':
print('父进程 (%s)...' % (os.getpid()))
p = Process(target=run_pro, args=('test',))
print('子进程开始运行啦~~')
p.start()
p.join()
print('子进程结束~~')
python入门之多进程
最新推荐文章于 2024-07-12 16:16:27 发布